diff --git a/filcnaplo/lib/utils/format.dart b/filcnaplo/lib/utils/format.dart index eff52b9..3a9878f 100644 --- a/filcnaplo/lib/utils/format.dart +++ b/filcnaplo/lib/utils/format.dart @@ -1,3 +1,4 @@ +import 'package:filcnaplo_kreta_api/models/week.dart'; import 'package:flutter/widgets.dart'; import 'package:intl/intl.dart'; import 'package:i18n_extension/i18n_widget.dart'; @@ -45,13 +46,18 @@ extension DateFormatUtils on DateTime { if (now.year == this.year && now.month == this.month && now.add(Duration(days: 1)).day == this.day) return "Tomorrow".i18n; String formatString; - if (this.year == now.year) - formatString = "MMM dd."; - else - formatString = "yy/MM/dd"; - if (weekday) formatString += " (EEEE)"; + // If date is current week, show only weekday + if (Week.current().start.isBefore(this) && Week.current().end.isAfter(this)) + formatString = "EEEE"; // ex. monday + else { + if (this.year == now.year) + formatString = "MMM dd."; // ex. Jan. 01. + else + formatString = "yy/MM/dd"; // ex. 21/01/01 - return DateFormat(formatString, I18n.of(context).locale.toString()).format(this); + if (weekday) formatString += " (EEEE)"; // ex. (monday) + } + return DateFormat(formatString, I18n.of(context).locale.toString()).format(this).capital(); } } diff --git a/filcnaplo_mobile_ui b/filcnaplo_mobile_ui index f15aa89..a19ca7e 160000 --- a/filcnaplo_mobile_ui +++ b/filcnaplo_mobile_ui @@ -1 +1 @@ -Subproject commit f15aa89bf5f911b9e641a8b62e90e56727ac037e +Subproject commit a19ca7e8f76bd7285da2503c83539bca095670dd