chore: Show short forms of months and week days in UI
This commit is contained in:
parent
612711d602
commit
ebd8b700b1
1 changed files with 5 additions and 10 deletions
|
|
@ -56,19 +56,14 @@ extension DateTimeExtension on DateTime {
|
||||||
if (sameDay) {
|
if (sameDay) {
|
||||||
return localizedTimeOfDay(context);
|
return localizedTimeOfDay(context);
|
||||||
} else if (sameWeek) {
|
} else if (sameWeek) {
|
||||||
return DateFormat.EEEE(Localizations.localeOf(context).languageCode)
|
return DateFormat.E(Localizations.localeOf(context).languageCode)
|
||||||
.format(this);
|
.format(this);
|
||||||
} else if (sameYear) {
|
} else if (sameYear) {
|
||||||
return L10n.of(context)!.dateWithoutYear(
|
return DateFormat.MMMd(Localizations.localeOf(context).languageCode)
|
||||||
month.toString().padLeft(2, '0'),
|
.format(this);
|
||||||
day.toString().padLeft(2, '0'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return L10n.of(context)!.dateWithYear(
|
return DateFormat.yMMMd(Localizations.localeOf(context).languageCode)
|
||||||
year.toString(),
|
.format(this);
|
||||||
month.toString().padLeft(2, '0'),
|
|
||||||
day.toString().padLeft(2, '0'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the DateTime is today, this returns [localizedTimeOfDay()], if not it also
|
/// If the DateTime is today, this returns [localizedTimeOfDay()], if not it also
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue