Skip to content

Commit

Permalink
Display published at date for news articles (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
JElgar authored Aug 21, 2024
1 parent 953e224 commit a6ddf6f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/assets/components/explore_tiles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class ExploreNewsArticleTile extends ExploreTile {
.apply(fontStyle: FontStyle.normal),
),
Text(
article.releasedAt.let(DateFormat('d MMM y').format),
article.publishedAt.let(DateFormat('d MMM y').format),
),
],
),
Expand Down
3 changes: 3 additions & 0 deletions lib/models/article.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class NewsArticle implements Explorable {
final String subtitle;
final Api.Image headerImage;
final DateTime releasedAt;
final DateTime publishedAt;
final Uri link;

NewsArticle({
Expand All @@ -34,6 +35,7 @@ class NewsArticle implements Explorable {
required this.subtitle,
required this.headerImage,
required this.releasedAt,
required this.publishedAt,
required this.link,
});

Expand All @@ -43,6 +45,7 @@ class NewsArticle implements Explorable {
subtitle = apiModel.subtitle,
headerImage = apiModel.headerImage,
releasedAt = apiModel.releaseAt,
publishedAt = apiModel.publishedAt,
link = Uri.parse(apiModel.link);

String get shortUrl => link.host;
Expand Down
1 change: 1 addition & 0 deletions test/factories/article_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ArticleFactory extends ModelFactory<NewsArticle> {
headerImage: ImageFactory().generate(),
link: Uri.parse(faker.internet.httpsUrl()),
releasedAt: faker.date.dateTime(),
publishedAt: faker.date.dateTime(),
);
}
}

0 comments on commit a6ddf6f

Please sign in to comment.