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

XDate diffMonths/addMonths returning incorrect date. #36

Open
shriniketsarkar-zz opened this issue Jul 5, 2017 · 0 comments
Open

XDate diffMonths/addMonths returning incorrect date. #36

shriniketsarkar-zz opened this issue Jul 5, 2017 · 0 comments

Comments

@shriniketsarkar-zz
Copy link

shriniketsarkar-zz commented Jul 5, 2017

Eg :

new XDate('2011-05-22').diffMonths(new XDate('2016-02-26T14:06:00.000Z'))
Response : 57.13991935483871
new XDate('2011-05-22').addMonths(57.13991935483871)
Response : h {0: Fri Feb 26 2016 08:06:00 GMT-0600 (CST)}

The above example has a correct response indicating that adding the difference in months to the initial date gets you the second date.

new XDate('2011-05-22').diffMonths(new XDate('2016-03-01T15:26:00.000Z'))
Response : 57.33525985663083
new XDate('2011-05-22').addMonths(57.33525985663083)
Response : h {0: Thu Mar 03 2016 09:26:00 GMT-0600 (CST)}

The above example has an incorrect response where adding the difference in months to the initial date gets you a date which is 2 days after the expected date.

Is this an issue or am I just using the library incorrectly ?

I have tried this with the latest tag version : XDate v0.8.2 of the library.

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