jsheroes / community-help

Helping others is fun, ask away and the ClujJavaScripters community will help you!
15 stars 0 forks source link

recurrence rules library with timezone support #12

Open vladnicula opened 7 years ago

vladnicula commented 7 years ago

Let's say I have a recurrence rule for "Every first Monday of the month at 23:30" starting at startTime: x.

First Monday of December in UK starts at a different time-stamp than First Monday of December in China.

I'm implementing an application that would be able to switch between any given timezone, regardless of the browsers local timezone.So I could be in Romania, and ask the application to display all dates in relation to China's timezone.

Has anyone played with a library that can answer a question like:

"Give me all first Mondays between X and Y time-stamps, IN CHINA"?

Or maybe I'm not thinking about this right.

alexnm commented 7 years ago

Have you tried playing with moment? http://momentjs.com/

vladnicula commented 7 years ago

moment, moment-timezone and rrule. Now trying moment-recur.

I am using moment-timezone for dealing with timezone formatting and keeping 'floating' dates (like alarm clock which need to be timezone independent) in check.

Querying for the first Monday when the recurrence rule starts in a UTC time that appears to be Tuesday is a bit trickier and not supported natively by moment.