Skip to content

XDate diffMonths/addMonths returning incorrect date.  #36

@shriniketsarkar-zz

Description

@shriniketsarkar-zz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions