mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: wrong day of week (#2468)
This commit is contained in:
parent
06f056aa4b
commit
6731037a8c
@ -171,8 +171,9 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _headerWeekDayBuilder(day) {
|
Widget _headerWeekDayBuilder(day) {
|
||||||
|
// incoming day starts from Monday, the symbols start from Sunday
|
||||||
final symbols = DateFormat.EEEE(context.locale.toLanguageTag()).dateSymbols;
|
final symbols = DateFormat.EEEE(context.locale.toLanguageTag()).dateSymbols;
|
||||||
final weekDayString = symbols.WEEKDAYS[day];
|
final weekDayString = symbols.WEEKDAYS[(day + 1) % 7];
|
||||||
return Center(
|
return Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: CalendarSize.daysOfWeekInsets,
|
padding: CalendarSize.daysOfWeekInsets,
|
||||||
@ -216,8 +217,8 @@ class _CalendarPageState extends State<CalendarPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WeekDays _weekdayFromInt(int dayOfWeek) {
|
WeekDays _weekdayFromInt(int dayOfWeek) {
|
||||||
// MonthView places the first day of week on the second column for some reason.
|
// dayOfWeek starts from Sunday, WeekDays starts from Monday
|
||||||
return WeekDays.values[(dayOfWeek + 1) % 7];
|
return WeekDays.values[(dayOfWeek - 1) % 7];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ class FirstDayOfWeek extends StatelessWidget {
|
|||||||
DateFormat.EEEE(context.locale.toLanguageTag()).dateSymbols;
|
DateFormat.EEEE(context.locale.toLanguageTag()).dateSymbols;
|
||||||
// starts from sunday
|
// starts from sunday
|
||||||
final items = symbols.WEEKDAYS.asMap().entries.map((entry) {
|
final items = symbols.WEEKDAYS.asMap().entries.map((entry) {
|
||||||
final index = (entry.key - 1) % 7;
|
final index = entry.key;
|
||||||
final string = entry.value;
|
final string = entry.value;
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: GridSize.popoverItemHeight,
|
height: GridSize.popoverItemHeight,
|
||||||
|
Loading…
Reference in New Issue
Block a user