Open xplwowi opened 4 years ago
Algorithm used in changeTime() and setRange() works incorrectly when start or end date falls on DST change day.
Currently both functions set date/time to beginning of the day then add to it selected hours and minutes, this way:
opt[name] = parseInt( moment(parseInt(date)) .startOf('day') .add(moment(opt[name + 'Time']).format('HH'), 'h') .add(moment(opt[name + 'Time']).format('mm'), 'm') .valueOf() );
For example, for year 2020 when selected time range is 00:00 – 23:59:
Problem can be solved by setting hours and minutes directly instead of adding them to the beginning of the day.
opt[name] = parseInt( moment(parseInt(date)) .startOf('day') .hour(moment(opt[name + 'Time']).format('H')) .minute(moment(opt[name + 'Time']).format('m')) .valueOf() );
Algorithm used in changeTime() and setRange() works incorrectly when start or end date falls on DST change day.
Currently both functions set date/time to beginning of the day then add to it selected hours and minutes, this way:
For example, for year 2020 when selected time range is 00:00 – 23:59:
Problem can be solved by setting hours and minutes directly instead of adding them to the beginning of the day.