This commit is contained in:
2024-06-10 19:35:27 +05:00
parent 4a75925f86
commit 3a36d185a3
3 changed files with 14 additions and 6 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ import {
eachDayOfInterval,
endOfMonth,
format,
getDay,
getISODay,
isEqual,
isWithinInterval,
parse,
@@ -89,7 +89,7 @@ function Calendar({ schedules, handleSelect, className }: CalendarProps) {
<div
key={day.toString()}
className={classNames(
dayIdx === 0 && colStartClasses[getDay(day) - 1]
dayIdx === 0 && colStartClasses[getISODay(day) - 1]
)}
>
<button
@@ -100,7 +100,7 @@ function Calendar({ schedules, handleSelect, className }: CalendarProps) {
(schedule) =>
!isWithinInterval(day, {
start: new Date(schedule.startDate),
end: addDays(new Date(schedule.startDate), 14),
end: addDays(new Date(schedule.startDate), 13),
})
)
}
+2 -2
View File
@@ -18,7 +18,7 @@ function SidebarTab1() {
companyId,
buildId,
} = useSidebarTabStore();
const [schedules, setSchedules] = useState<any[]>();
const [schedules, setSchedules] = useState<any[]>([]);
function handleSelectDay(day: Date) {
setSelectedDay(day);
@@ -79,7 +79,7 @@ function SidebarTab1() {
</div>
<div className="sm:mt-8 mt-6">
{schedules && schedules.length > 0 ? (
{schedules.length > 0 ? (
<Calendar
schedules={schedules}
handleSelect={(day) => handleSelectDay(day)}
+9 -1
View File
@@ -5,7 +5,12 @@ import { Trans } from "react-i18next";
import useSidebarTabStore from "../stores/useSidebarStore";
import TimeSelector from "./TimeSelector";
import CloseIcon from "./icons/CloseIcon";
import { eachMinuteOfInterval, format, isAfter, parse } from "date-fns";
import {
eachMinuteOfInterval,
format,
isAfter,
parse,
} from "date-fns";
import i18n from "../i18n";
import { enUS, ru } from "date-fns/locale";
import ky from "ky";
@@ -84,6 +89,9 @@ function SidebarTab2() {
if (!selectedDay || !build || !scheduledSessions || !schedule) return;
const step = schedule.sessionDuration + schedule.sessionBreak;
console.log("selectedDay", selectedDay);
const times = eachMinuteOfInterval(
{
start: parse(schedule.startTime, "HH:mm", selectedDay),