diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart index fe5e73097c..a9dae6500c 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart @@ -171,8 +171,9 @@ class _CalendarPageState extends State { } Widget _headerWeekDayBuilder(day) { + // incoming day starts from Monday, the symbols start from Sunday final symbols = DateFormat.EEEE(context.locale.toLanguageTag()).dateSymbols; - final weekDayString = symbols.WEEKDAYS[day]; + final weekDayString = symbols.WEEKDAYS[(day + 1) % 7]; return Center( child: Padding( padding: CalendarSize.daysOfWeekInsets, @@ -216,8 +217,8 @@ class _CalendarPageState extends State { } WeekDays _weekdayFromInt(int dayOfWeek) { - // MonthView places the first day of week on the second column for some reason. - return WeekDays.values[(dayOfWeek + 1) % 7]; + // dayOfWeek starts from Sunday, WeekDays starts from Monday + return WeekDays.values[(dayOfWeek - 1) % 7]; } } diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/toolbar/calendar_layout_setting.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/toolbar/calendar_layout_setting.dart index 81f79e5061..ceef7e3f58 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/toolbar/calendar_layout_setting.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/toolbar/calendar_layout_setting.dart @@ -340,7 +340,7 @@ class FirstDayOfWeek extends StatelessWidget { DateFormat.EEEE(context.locale.toLanguageTag()).dateSymbols; // starts from sunday final items = symbols.WEEKDAYS.asMap().entries.map((entry) { - final index = (entry.key - 1) % 7; + final index = entry.key; final string = entry.value; return SizedBox( height: GridSize.popoverItemHeight,