Skip to content

Commit 2ca0226

Browse files
anna-kartynnikjquense
authored andcommitted
fix: calculation of slots number for date when DST ends. (#1046)
1 parent 4e04fc8 commit 2ca0226

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/utils/TimeSlots.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import dates from './dates'
22

33
const getDstOffset = (start, end) =>
4-
Math.abs(start.getTimezoneOffset() - end.getTimezoneOffset())
4+
start.getTimezoneOffset() - end.getTimezoneOffset()
55

66
const getKey = (min, max, step, slots) =>
77
`${+dates.startOf(min, 'minutes')}` +
@@ -105,7 +105,7 @@ export function getSlotMetrics({ min: start, max: end, step, timeslots }) {
105105
if (dates.lt(date, start, 'minutes')) return slots[0]
106106

107107
const diffMins = dates.diff(start, date, 'minutes')
108-
return slots[(diffMins - diffMins % step) / step + offset]
108+
return slots[(diffMins - (diffMins % step)) / step + offset]
109109
},
110110

111111
startsBeforeDay(date) {
@@ -130,11 +130,11 @@ export function getSlotMetrics({ min: start, max: end, step, timeslots }) {
130130

131131
const rangeStartMin = positionFromDate(rangeStart)
132132
const rangeEndMin = positionFromDate(rangeEnd)
133-
const top = rangeStartMin / totalMin * 100
133+
const top = (rangeStartMin / totalMin) * 100
134134

135135
return {
136136
top,
137-
height: rangeEndMin / totalMin * 100 - top,
137+
height: (rangeEndMin / totalMin) * 100 - top,
138138
start: positionFromDate(rangeStart),
139139
startDate: rangeStart,
140140
end: positionFromDate(rangeEnd),

0 commit comments

Comments
 (0)