SwiftMoment
SwiftMoment copied to clipboard
Unexpected value when adding months.
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?
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!