Skip to content

Commit 92024bd

Browse files
committed
fix(ui_kit): use timeago package for relative timestamps
- Replace custom timestamp formatting with timeago package - Add import for timeago package - Update build method to use timeago.format() for createdAt date
1 parent f438cca commit 92024bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/shared/widgets/headline_tile_image_start.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:ht_main/entity_details/view/entity_details_page.dart';
44
import 'package:ht_main/router/routes.dart';
55
import 'package:ht_shared/ht_shared.dart';
66
import 'package:ht_ui_kit/ht_ui_kit.dart';
7+
import 'package:timeago/timeago.dart' as timeago;
78

89
/// {@template headline_tile_image_start}
910
/// A shared widget to display a headline item with a small image at the start.
@@ -136,8 +137,7 @@ class _HeadlineMetadataRow extends StatelessWidget {
136137

137138
@override
138139
Widget build(BuildContext context) {
139-
// TODO(anyone): Use a proper timeago library.
140-
final formattedDate = headline.createdAt.toString();
140+
final formattedDate = timeago.format(headline.createdAt);
141141

142142
// Use bodySmall for a reasonable base size, with muted accent color
143143
final metadataTextStyle = textTheme.bodySmall?.copyWith(

0 commit comments

Comments
 (0)