Fix timezones
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useMemo, useState, useEffect, Fragment } from 'react';
|
||||
import { useStats } from '../../hooks/useStats';
|
||||
import { timeToMinutes } from '../../utils/time';
|
||||
import { timeToMinutes, adjustForTimezone } from '../../utils/time';
|
||||
|
||||
interface TimetableProps {
|
||||
from_date: string;
|
||||
@@ -106,8 +106,8 @@ const Timetable = ({ from_date, to_date, day_start, day_end }: TimetableProps) =
|
||||
return timetable.slots.some((slot) => {
|
||||
if (slot.date !== date || !slot.sleeping) return false;
|
||||
|
||||
const sStart = timeToMinutes(slot.slot_start);
|
||||
const sEnd = timeToMinutes(slot.slot_end);
|
||||
const sStart = adjustForTimezone(timeToMinutes(slot.slot_start));
|
||||
const sEnd = adjustForTimezone(timeToMinutes(slot.slot_end));
|
||||
|
||||
if (sEnd <= sStart) {
|
||||
const overlap1 = Math.max(sStart, intervalStart) < Math.min(1440, intervalEnd);
|
||||
|
||||
Reference in New Issue
Block a user