Merge pull request #643 from kolplattformen/fix/wrong-date2

fix: 🐛 Better fix for the isoWeek bug in Timetable
This commit is contained in:
Kajetan Kazimierczak 2023-01-14 18:36:33 +01:00 committed by GitHub
commit 6d49e4767c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) => {
const locale = LanguageService.getLocale()
moment.updateLocale(locale, {
week: {
dow: 1, // Monday is the first day of the week.
},
})
moment.locale(locale)
moment.locale(LanguageService.getLocale())
const days = moment.weekdaysShort().slice(1, 6)
const displayDate = getMeaningfulStartingDate(moment())
@ -165,7 +159,10 @@ export const Week = ({ child }: WeekProps) => {
<>
<Text style={styles.tabTitle}>{weekDay}</Text>
<Text style={styles.tabTitleDate}>
{displayDate.startOf('week').add(index, 'day').format('D')}
{displayDate
.startOf('isoWeek')
.add(index, 'day')
.format('D')}
</Text>
</>
)}