Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Unexpected value when adding months. #51

Open
ghost opened this issue Jun 4, 2016 · 1 comment
Open

Unexpected value when adding months. #51

ghost opened this issue Jun 4, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 4, 2016

When trying to add months to an instance of Moment I get an unexpected value. I would expect the following example to return an instance of Moment representing the 1st of June 2016 but instead it returns 31st of May 2016.

    let beginOfMonth = moment([2016, 5, 1, 0, 0, 0])!
    let nextMonth = beginOfMonth.add(1, .Months))

Wouldn't it make more sens to add value to the Month component of NSDate using NSDateComponents instead of simply adding 30 days?

@akosma
Copy link
Owner

akosma commented Jun 6, 2016

Valid point, but right now this is the behavior by design in the current version of the library. I will address this in a future release. Thanks!

@akosma akosma closed this as completed Jun 6, 2016
@akosma akosma reopened this Jun 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant