Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions to get next/last DST transitions #266

Open
mattjohnsonpint opened this issue Oct 30, 2015 · 9 comments · May be fixed by #431
Open

Functions to get next/last DST transitions #266

mattjohnsonpint opened this issue Oct 30, 2015 · 9 comments · May be fixed by #431

Comments

@mattjohnsonpint
Copy link
Contributor

From StackOverflow.

It would be nice to have getNextTransition and related functions.

The function should go in moment proper first, where it will need to scan the local environment's time zone.

Then it can be hooked into moment-timezone such that we use the untils array of a specific time zone.

@fakenickels
Copy link

It would be awesome

@desnyki
Copy link

desnyki commented Feb 17, 2016

You could easily achieve this by getting the moment.tz.zone().untils nearest to current UTC time

@mattjohnsonpint
Copy link
Contributor Author

Updated the original description. This can all go into moment-timezone, and should use the functions we created as part of the .guess() function when working with an regular moment object in local mode.

@petrgazarov
Copy link

Is this still needed? The stack overflow thread no longer exists, so I'm not sure about what the requirements/context are. Otherwise would love to take this task if not too complex (this would be my first PR to moment js). Thanks!!

@mattjohnsonpint
Copy link
Contributor Author

@petrgazarov - Yes, it's still needed. The example in the S.O. thread was:

moment().tz('Europe/Paris').getNextDST();

I'm not sure that's the exact API that we'd want, but something like that. A proposal would be welcome.

@mnunezNearsoft
Copy link

@mj1856 I would like to work on this issue, where can I hook the new function?

@petrgazarov petrgazarov linked a pull request Dec 13, 2016 that will close this issue
@getriebesand
Copy link

can you add these Functions to the Zone Object? So I can do moment.ts.zone('Europe/Berlin').getNextTransition(date).isDST()
and getPreviousTransition(date)

@maggiepint
Copy link
Member

Yes, you should be able to hook the zone.

@petrgazarov
Copy link

There is already a PR for this for those interesting in reviewing: #431 😃

I followed @mj1856 's example, but hooking it up to Zone object shouldn't be a big deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants