I'm using SwiftDate
(from malcommac.github
) to validate string dates, but I find that it accepts as valid the 31st of ANY month (Feb, Nov, whatever). The 32nd of any month fails on a SwiftDate.DateError.FailedToParse
.
The following is taken from an example on the SwiftDate
GitHub page. The printed result is 01 dic 1999, 23:30:00 CET
.
let regionRome = Region(tz: TimeZoneName.europeRome, cal: CalendarName.gregorian, loc: LocaleName.italian)
// Parse a string which a custom format
let date1 = try! DateInRegion(string: "1999-11-31 23:30:00", format: .custom("yyyy-MM-dd HH:mm:ss"), fromRegion: regionRome)
print(date1)
Am I overlooking something? I assume this result isn't intended.