mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
Fix calendar bug, closes #892
This commit is contained in:
parent
5ce457efa5
commit
066c0cf5ba
@ -106,12 +106,19 @@ export default function Calendar({ date, minDate, maxDate, onChange }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DaySelector = ({ date, minDate, maxDate, locale, onSelect }) => {
|
const DaySelector = ({ date, minDate, maxDate, locale, onSelect }) => {
|
||||||
const startWeek = startOfWeek(date, { locale: getDateLocale(locale) });
|
const dateLocale = getDateLocale(locale);
|
||||||
const startMonth = startOfMonth(date, { locale: getDateLocale(locale) });
|
const weekStartsOn = dateLocale?.options?.weekStartsOn || 0;
|
||||||
const startDay = subDays(startMonth, startMonth.getDay());
|
const startWeek = startOfWeek(date, {
|
||||||
|
locale: dateLocale,
|
||||||
|
weekStartsOn,
|
||||||
|
});
|
||||||
|
const startMonth = startOfMonth(date);
|
||||||
|
const startDay = subDays(startMonth, startMonth.getDay() - weekStartsOn);
|
||||||
const month = date.getMonth();
|
const month = date.getMonth();
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
|
|
||||||
|
console.log({ dateLocale, startDay, startWeek, startMonth, month, year });
|
||||||
|
|
||||||
const daysOfWeek = [];
|
const daysOfWeek = [];
|
||||||
for (let i = 0; i < 7; i++) {
|
for (let i = 0; i < 7; i++) {
|
||||||
daysOfWeek.push(addDays(startWeek, i));
|
daysOfWeek.push(addDays(startWeek, i));
|
||||||
|
Loading…
Reference in New Issue
Block a user