From 2ca02266ef372f7ff4c48e85125bcc70114be3d0 Mon Sep 17 00:00:00 2001 From: Anna Kartynnik Date: Fri, 2 Nov 2018 12:51:02 -0700 Subject: [PATCH] fix: calculation of slots number for date when DST ends. (#1046) --- src/utils/TimeSlots.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/TimeSlots.js b/src/utils/TimeSlots.js index 9a752be8e..84d33dc93 100644 --- a/src/utils/TimeSlots.js +++ b/src/utils/TimeSlots.js @@ -1,7 +1,7 @@ import dates from './dates' const getDstOffset = (start, end) => - Math.abs(start.getTimezoneOffset() - end.getTimezoneOffset()) + start.getTimezoneOffset() - end.getTimezoneOffset() const getKey = (min, max, step, slots) => `${+dates.startOf(min, 'minutes')}` + @@ -105,7 +105,7 @@ export function getSlotMetrics({ min: start, max: end, step, timeslots }) { if (dates.lt(date, start, 'minutes')) return slots[0] const diffMins = dates.diff(start, date, 'minutes') - return slots[(diffMins - diffMins % step) / step + offset] + return slots[(diffMins - (diffMins % step)) / step + offset] }, startsBeforeDay(date) { @@ -130,11 +130,11 @@ export function getSlotMetrics({ min: start, max: end, step, timeslots }) { const rangeStartMin = positionFromDate(rangeStart) const rangeEndMin = positionFromDate(rangeEnd) - const top = rangeStartMin / totalMin * 100 + const top = (rangeStartMin / totalMin) * 100 return { top, - height: rangeEndMin / totalMin * 100 - top, + height: (rangeEndMin / totalMin) * 100 - top, start: positionFromDate(rangeStart), startDate: rangeStart, end: positionFromDate(rangeEnd),