SwiftMoment
SwiftMoment copied to clipboard
Subtracting months edge case - subtracts 30 days
It seems to subtract 30 days instead of 1 whole month.
Detailed Description
If the starting date is 1/30/2018, and I subtract 1 month, it becomes 12/31/2017, I would have expected 12/30/2017. If I subtract 2 months, it becomes 12/01/2017. I would have expected it to be 11/30/2017.
Your Environment
- Version used: 0.7
- Operating System and version: latest version of Swift, Xcode
same problem
the data should be 2018-02-02 16:00:00
but after moment(date, dateFormat: "YYYY-MM-DD HH:mm:ss")!
the date change to 2018-01-02 16:00:00 GMT+08:00
i find a way can to avoid this bug
use moment(year,month,day,hour,minute,second)
to create , do not use dateFormat, seems can avoid the bugs