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

Subtracting months edge case - subtracts 30 days #101

Open
phaddius opened this issue Jan 30, 2018 · 2 comments
Open

Subtracting months edge case - subtracts 30 days #101

phaddius opened this issue Jan 30, 2018 · 2 comments

Comments

@phaddius
Copy link

phaddius commented Jan 30, 2018

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
@WingCH
Copy link

WingCH commented Feb 2, 2018

image

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

@WingCH
Copy link

WingCH commented Feb 2, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants