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

Adding negative months does not rollover year #33

Closed
msravi opened this issue Jan 8, 2014 · 3 comments
Closed

Adding negative months does not rollover year #33

msravi opened this issue Jan 8, 2014 · 3 comments

Comments

@msravi
Copy link

msravi commented Jan 8, 2014

Hi,

Looks like adding -ve months doesn't rollover the year:

julia> using Datetime

julia> today()
2014-01-08

julia> today()+months(1)
2014-02-08

julia> today()+months(-1)
2014-12-08
*** Should return 2013-12-08 ***

*** The following work alright ***
julia> today()+days(-1)
2014-01-07

julia> dt = date("2014-01-01")
2014-01-01

julia> dt+days(-1)
2013-12-31

julia> today()+years(-1)
2013-01-08

Hope this helps.

Regards,
Ravi

@msravi
Copy link
Author

msravi commented Jan 8, 2014

Similarly,

julia> date("2013-12-27")-months(-1)
2013-01-27

Regards,
Ravi

@quinnj
Copy link
Owner

quinnj commented Jan 8, 2014

Thanks. Yeah, I found this as well as I was doing the rewrite to merge into Base. See JuliaLang/julia#5328. The examples above work on that code and I'll add some more tests for these.

@quinnj
Copy link
Owner

quinnj commented Feb 28, 2014

Fixed by ed8123e

@quinnj quinnj closed this as completed Feb 28, 2014
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

2 participants