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

LocalDateRange::toInterval #83

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

Conversation

solodkiy
Copy link
Contributor

Converting LocalDateRange to Interval is a common task in my app. Typically, I have a method to generate reports that expects a LocalDateRange argument. Subsequently, I need to transform it for SQL queries using the BETWEEN operator. It’s important to note that the timezone in my database differs from the implied timezone in LocalDateRange.

The new method introduced will transform any LocalDateRange into an Interval in the specified timezone.

@solodkiy solodkiy force-pushed the LocalDateRange_toInterval branch 2 times, most recently from a81d95d to 3517451 Compare September 30, 2023 16:10
@solodkiy solodkiy force-pushed the LocalDateRange_toInterval branch from 3517451 to 4b22406 Compare September 30, 2023 16:12
Comment on lines +247 to +252
/**
* Converts this LocalDateRange to Interval instance.
*
* The result is Interval from 00:00 start date and 00:00 end date + one day (because end in Interval is exclude)
* in the given time-zone.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Converts this LocalDateRange to Interval instance.
*
* The result is Interval from 00:00 start date and 00:00 end date + one day (because end in Interval is exclude)
* in the given time-zone.
*/
/**
* Converts this LocalDateRange to an Interval in the given TimeZone.
*
* The result is an Interval from 00:00 on the start date to 00:00 on the end date + one day
* (the end Instant of Interval being exclusive).
*/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should we add a warning relative to this?

As to what happens if 00:00 falls within a DST transition (I'm not even sure if this is possible in any timezone).

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

Successfully merging this pull request may close these issues.

2 participants