From b4803c17dee308bbdb4a6a88539b6b0da6716ddf Mon Sep 17 00:00:00 2001 From: Ansul Agrawal Date: Wed, 13 Nov 2024 01:01:28 +0530 Subject: [PATCH] Fix the locale issue --- src/components/EventItem.jsx | 2 +- src/components/SchedulerData.js | 2 +- src/helper/behaviors.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/EventItem.jsx b/src/components/EventItem.jsx index bf7fc30..6e60b45 100644 --- a/src/components/EventItem.jsx +++ b/src/components/EventItem.jsx @@ -15,7 +15,7 @@ const stopDragHelper = ({ count, cellUnit, config, dragType, eventItem, localeDa while (whileTrue) { i = count > 0 ? i + 1 : i - 1; const date = localeDayjs(new Date(eventItem[dragType])).add(i, 'days'); - const dayOfWeek = date.weekday(); + const dayOfWeek = date.day(); if (dayOfWeek !== 0 && dayOfWeek !== 6) { tCount = count > 0 ? tCount + 1 : tCount - 1; diff --git a/src/components/SchedulerData.js b/src/components/SchedulerData.js index fdfed08..cdcfbdc 100644 --- a/src/components/SchedulerData.js +++ b/src/components/SchedulerData.js @@ -698,7 +698,7 @@ export default class SchedulerData { } else if (this.cellUnit === CellUnit.Day) { while (header >= start && header <= end) { const time = header.format(DATETIME_FORMAT); - const dayOfWeek = header.weekday(); + const dayOfWeek = header.day(); if (this.config.displayWeekend || (dayOfWeek !== 0 && dayOfWeek !== 6)) { const nonWorkingTime = this.behaviors.isNonWorkingTimeFunc(this, time); headers.push({ time, nonWorkingTime }); diff --git a/src/helper/behaviors.js b/src/helper/behaviors.js index f1a56f8..4ad657d 100644 --- a/src/helper/behaviors.js +++ b/src/helper/behaviors.js @@ -70,7 +70,7 @@ export const isNonWorkingTime = (schedulerData, time) => { const hour = localeDayjs(new Date(time)).hour(); return hour < 9 || hour > 18; } - const dayOfWeek = localeDayjs(new Date(time)).weekday(); + const dayOfWeek = localeDayjs(new Date(time)).day(); return dayOfWeek === 0 || dayOfWeek === 6; };