Last active
July 23, 2019 16:08
-
-
Save maggiben/10d494dfa42c7646017ee45ed0d60bf5 to your computer and use it in GitHub Desktop.
Given a date and a recurrence rule show the next occurrence
This file contains hidden or 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
| var options = RRule.parseString('FREQ=MONTHLY;INTERVAL=1'); | |
| options.dtstart = moment.utc('2019-05-16 12:30:00').toDate(); | |
| options.count = 2; | |
| var rule = new RRule(options) | |
| var nextRun = rule.all().slice(-1).pop(); | |
| console.log(moment(nextRun).format('YYYY-MM-DD H:mm:ss')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment