From 17836c70e748e1ee01012e02e8efa72b1b3dc845 Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Wed, 10 Mar 2021 10:11:23 +0100 Subject: [PATCH] feature(calendar): use locale for start of week --- components/common/Calendar.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/common/Calendar.js b/components/common/Calendar.js index 237f065e..92fd311c 100644 --- a/components/common/Calendar.js +++ b/components/common/Calendar.js @@ -20,6 +20,7 @@ import Button from './Button'; import useLocale from 'hooks/useLocale'; import { dateFormat } from 'lib/date'; import { chunk } from 'lib/array'; +import { dateLocales } from 'lib/lang'; import Chevron from 'assets/chevron-down.svg'; import Cross from 'assets/times.svg'; import styles from './Calendar.module.css'; @@ -105,8 +106,8 @@ export default function Calendar({ date, minDate, maxDate, onChange }) { } const DaySelector = ({ date, minDate, maxDate, locale, onSelect }) => { - const startWeek = startOfWeek(date); - const startMonth = startOfMonth(date); + const startWeek = startOfWeek(date, { locale: dateLocales[locale] }); + const startMonth = startOfMonth(date, { locale: dateLocales[locale] }); const startDay = subDays(startMonth, startMonth.getDay()); const month = date.getMonth(); const year = date.getFullYear();