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

Invalid deprecation error for Date::startOfWeek() #453

Closed
jurchiks opened this issue Jun 13, 2024 · 3 comments
Closed

Invalid deprecation error for Date::startOfWeek() #453

jurchiks opened this issue Jun 13, 2024 · 3 comments

Comments

@jurchiks
Copy link

I just updated my installation of Chronos to the latest available version for the project (PHP 7.3, so best I get is 2.4.4), and I got this nonsensical error:
(new Date($anyDateHere))->addWeeks(1)->startOfWeek()
throws
2.5 startOfDay() will be removed in 3.x.
But this method calls startOfDay() implicitly, under the hood, users can't NOT call it.

@jurchiks jurchiks changed the title Invalid deprecation error for Date Invalid deprecation error for Date::startOfWeek() Jun 13, 2024
@othercorey othercorey added this to the 2.x milestone Jun 14, 2024
@othercorey
Copy link
Member

@markstory What do you think?

@ravage84
Copy link
Member

startOfDay() just does return $this->modify('midnight');.

So why not do that where startOfDay() is currently called?

@ravage84
Copy link
Member

Same for endOfDay(), by the way.

markstory added a commit that referenced this issue Jul 24, 2024
These tests are passing without errors or deprecations currently.
markstory added a commit that referenced this issue Jul 24, 2024
Fix deprecations for startOfDay/endOfDay being called by
startOfWeek/endOfWeek. Because dates don't have times we don't need to
modify any time related components and can just return early.

Fixes #453
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

4 participants