forked from harrisiirak/cron-parser
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: workaround moment issue with DST transitions
On DST end transition, setting the date to the `startOf` `hour`, `minute` or `second` after having added 1 `hour`, `minute` or `second` to the date, would result in the date set to the initial value causing an infinite loop. Example: ```js 'use strict'; const moment = require('moment-timezone'); var m = moment(new Date('Sun Oct 30 2016 02:00:00 GMT+0200')); console.log(m.toString(), '<-- Just 1 hour before the DST end @ Europe/Madrid'); m.add(1, 'hours'); console.log(m.toString(), '<-- DST end transition @ Europe/Madrid works correctly'); m.startOf('hour'); console.log(m.toString(), '<-- Smthing wrong?? It goes back to the previous hour'); ``` Fixes: harrisiirak#72 Ref: moment/moment#2749
- Loading branch information
1 parent
6ca9d62
commit 986f126
Showing
2 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters