akosma / SwiftMoment

A time and calendar manipulation library for iOS 9+, macOS 10.11+, tvOS 9+, watchOS 2+ written in Swift 4.
http://akosma.github.io/SwiftMoment
BSD 2-Clause "Simplified" License
1.61k stars 147 forks source link

bugs in endof #86

Open qgliu opened 7 years ago

qgliu commented 7 years ago

A bug in endof month (especially February 2017)?

print("endof m", moment().endOf(TimeUnit.Months).date.toDateTime())
print("start of next -1", moment().add(1, TimeUnit.Months).startOf(TimeUnit.Months).subtract(1, "d").date.toDateTime())

The results are 3/2/17, 11:59 PM and 2/28/17, 12:00 AM

I am with Version 0.6