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

Add getNextDST() and getLastDST() functions #431

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

petrgazarov
Copy link

Resolves #266.

Adds getNextDST() and getLastDST() on tz with an option to pass in a date or moment object as an argument (to be used as benchmark when calculating the result). If no argument is given, compares to current time of the guess()ed zone.

Would be happy to add docs once code is approved. Thanks!

@petrgazarov
Copy link
Author

I saw this locally too - not sure why the tests are failing. If you run :core only, they pass. When the whole suite is run, untils array ends up with only [ Infinity ] in it, which makes me think something is not properly loaded.

@getriebesand
Copy link

please hook is to the Zone Object, and name the functions getNextTransition and getPreviousTransition because not all Transitions are DST Transitions.

@petrgazarov petrgazarov force-pushed the add-nearest-DST-functions branch 4 times, most recently from 574d3fb to 51be029 Compare February 4, 2017 02:16
@drmrbrewer
Copy link

What's the status of this feature? (I'm not too familiar with the way changes are progressed in a library such as this.) I'd love to see these functions implemented, not only the next DST transition relative to now, but the next one relative to a specified UTC time. Are they in a beta version or anything? I could knock something up for my own purposes using untils but I'd rather not re-invent the wheel if it has already been invented.

@petrgazarov
Copy link
Author

Hey @drmrbrewer, sorry about the delay. If you would like to take this on, I believe the feature is complete on my branch. Just need to pass tests. Thanks!

@wayofthefuture
Copy link

+1

@ichernev
Copy link
Contributor

If it's just a for loop over some offsets, it could be done as a binary search (maybe not worth it if the changes are less than 100). I'm not sure the guess() call is warranted, but getting next/previous transition from a timestamp is a nice feature. It should be well defined in case it matches the timestamp as well.

@Lev-Shapiro
Copy link

Lev-Shapiro commented Sep 30, 2023

@ichernev I was searching for a project to contribute to, all these open pull requests weren't published because there are some problems in the code, right? So that means if someone will fix it - it will be merged?

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

Successfully merging this pull request may close these issues.

Functions to get next/last DST transitions
6 participants