Skip to content

Commit

Permalink
chore: Show short forms of months and week days in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
krille-chan committed Aug 11, 2024
1 parent 612711d commit ebd8b70
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/utils/date_time_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,14 @@ extension DateTimeExtension on DateTime {
if (sameDay) {
return localizedTimeOfDay(context);
} else if (sameWeek) {
return DateFormat.EEEE(Localizations.localeOf(context).languageCode)
return DateFormat.E(Localizations.localeOf(context).languageCode)
.format(this);
} else if (sameYear) {
return L10n.of(context)!.dateWithoutYear(
month.toString().padLeft(2, '0'),
day.toString().padLeft(2, '0'),
);
return DateFormat.MMMd(Localizations.localeOf(context).languageCode)
.format(this);
}
return L10n.of(context)!.dateWithYear(
year.toString(),
month.toString().padLeft(2, '0'),
day.toString().padLeft(2, '0'),
);
return DateFormat.yMMMd(Localizations.localeOf(context).languageCode)
.format(this);
}

/// If the DateTime is today, this returns [localizedTimeOfDay()], if not it also
Expand Down

0 comments on commit ebd8b70

Please sign in to comment.