melvitax/DateHelper

init Date fromString returns nil when 2017-10-15

fabiwerneck opened this issue · 4 comments

Even w/ format: .custom it returns nil.

afdate_error

same issue with 1972-05-28

Ok, I have found solution.

On daylight saving dates the parser return nil. 2017-10-15 in Brazil for example at 00:00 is an invalid date.

You can patch this with isLenient flag enabled or pass date with valid hour.

@m3rLin0WoRK Let me know if this fixes your issue

Yes this work, but be careful because an invalid date like 2017-02-30 return a valid Date (first of March) that in certain cases could not be the desired result.