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

Fixed wrong behavior of dateAt(.startOfMonth) #700

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

makesource
Copy link
Contributor

Thank you for your great library 😀
Any suggestions and thoughts will be appreciated :)

I think it's odd that two similar helper functions have different results.
For example

Date("2019-10-03 15:32:15", format: "yyyy-MM-dd HH:mm:ss").dateAt(.startOfMonth) // 2019-10-01 01:01:01 
Date("2019-10-03 15:32:15", format: "yyyy-MM-dd HH:mm:ss").dateAtStartOf(.month) // 2019-10-01 00:00:00 

We can not define the exact moments of endOfDay, endOfWeek, endOfMonth (depending on the minimum time unit you set).
However, it's so clear that startOfDay, startOfWeek, startOfMonth represent certain point in time which is yyyy-MM-dd 00:00:00.

So that's why dateAt(.startOfMonth), dateAtStartOf(.month)should have same results.
(and it's already same in .startOfDay, .startOfWeek)

@LabLamb
Copy link

LabLamb commented Jun 8, 2020

I would've been stuck for a long time if it weren't for this issue ticket

@malcommac malcommac added this to the 6.2.0 milestone Sep 15, 2020
@malcommac malcommac added the bug label Sep 15, 2020
@malcommac malcommac changed the base branch from master to develop September 15, 2020 12:10
@malcommac malcommac merged commit 2e76f04 into malcommac:develop Sep 15, 2020
@malcommac malcommac changed the title Fix the behavior of dateAt(.startOfMonth) Fixed wrong behavior of dateAt(.startOfMonth) Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants