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

Inconsistency in shift/2 with months, years #739

Open
nallwhy opened this issue Apr 11, 2023 · 2 comments
Open

Inconsistency in shift/2 with months, years #739

nallwhy opened this issue Apr 11, 2023 · 2 comments

Comments

@nallwhy
Copy link

nallwhy commented Apr 11, 2023

Steps to reproduce

> start_datetime = ~U[2024-02-29 09:00:00Z]
~U[2025-02-28 09:00:00Z]

> Timex.shift(start_datetime , months: 12)
~U[2025-03-01 09:00:00Z]

> Timex.shift(start_datetime , months: 12) == Timex.shift(start_datetime , years: 1)
false

Description of issue

  • What are the expected results?

The results of shifting 12 months and 1 year are the same.

@nallwhy
Copy link
Author

nallwhy commented Apr 11, 2023

In a non-leap year, a person with a birthday on 2/29 has a birthday party on 2/28.
But it's 3/1 in Timex.

m == 2 and d == 29 and :calendar.is_leap_year(y) ->

@nallwhy
Copy link
Author

nallwhy commented Apr 11, 2023

But it's a breaking change... I can just use my own fork of Timex.

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

No branches or pull requests

1 participant