fix: 🐛 Better fix for the isoWeek bug in Timetable

This commit is contained in:
Kajetan Kazimierczak 2023-01-14 18:31:02 +01:00
parent 3acd27cc1f
commit ea6b385b4f
1 changed files with 5 additions and 8 deletions

View File

@ -107,13 +107,7 @@ export const Day = ({ weekDay, lunch, lessons }: DayProps) => {
} }
export const Week = ({ child }: WeekProps) => { export const Week = ({ child }: WeekProps) => {
const locale = LanguageService.getLocale() moment.locale(LanguageService.getLocale())
moment.updateLocale(locale, {
week: {
dow: 1, // Monday is the first day of the week.
},
})
moment.locale(locale)
const days = moment.weekdaysShort().slice(1, 6) const days = moment.weekdaysShort().slice(1, 6)
const displayDate = getMeaningfulStartingDate(moment()) const displayDate = getMeaningfulStartingDate(moment())
@ -165,7 +159,10 @@ export const Week = ({ child }: WeekProps) => {
<> <>
<Text style={styles.tabTitle}>{weekDay}</Text> <Text style={styles.tabTitle}>{weekDay}</Text>
<Text style={styles.tabTitleDate}> <Text style={styles.tabTitleDate}>
{displayDate.startOf('week').add(index, 'day').format('D')} {displayDate
.startOf('isoWeek')
.add(index, 'day')
.format('D')}
</Text> </Text>
</> </>
)} )}