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

Cannot construct a relative date that always points to the _next_ future date & time #406

Open
Bilge opened this issue Aug 15, 2023 · 1 comment
Milestone

Comments

@Bilge
Copy link
Contributor

Bilge commented Aug 15, 2023

If we construct a date at midday, Tuesday with new Chronos('Tue 12:0'), but we are currently at 4pm tuesday, then this date will be 4 hours in the past. Let's suppose we always want the constructed date to be in the future. We could "fix" this by specifying new Chronos('next Tue 12:0'), which will point to 7 days ahead. However, if we are currently at 9am on a Tuesday, this will still point 7 days ahead, instead of to midday on the current day, because the next specifier only considers the date portion of the date/time compound and completely ignores the time. Therefore it is impossible to construct a relative date & time that always points to the next future occurrence of that specific date and time.

@Bilge Bilge changed the title Cannot construct a relative date that always point to a future date & time Cannot construct a relative date that always point to the _next_ future date & time Aug 15, 2023
@Bilge Bilge changed the title Cannot construct a relative date that always point to the _next_ future date & time Cannot construct a relative date that always points to the _next_ future date & time Aug 15, 2023
@markstory markstory added this to the 3.x milestone Aug 17, 2023
@othercorey
Copy link
Member

Chronos uses DateTimeImmutable for all parsing so we'd have to perform a post-parse adjustment to get this behavior.

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

No branches or pull requests

3 participants