SwiftMoment
SwiftMoment copied to clipboard
Problem with date parsing
Problem with parsing time format
- "h:mm:ss A",
- "h:mm A",
Detailed Description
According to Apple's ISO descriptions, A
represents microseconds, as opposed to AM/PM
.
Those formats should be changed to a
rather than A
.
Context
This causes issues for people trying to use SwiftMoment to represent times.
Possible Implementation
Change the formats to the following:
let formats = [
isoFormat,
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'",
"yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"yyyy-MM-dd",
"h:mm:ss A",
"h:mm A",
"h:mm:ss a", <---
"h:mm a", <---
"MM/dd/yyyy",
"MMMM d, yyyy",
"MMMM d, yyyy LT",
"dddd, MMMM D, yyyy LT",
"yyyyyy-MM-dd",
"yyyy-MM-dd",
"GGGG-[W]WW-E",
"GGGG-[W]WW",
"yyyy-ddd",
"HH:mm:ss.SSSS",
"HH:mm:ss",
"HH:mm",
"HH"
]
Your Environment
- Version used: Latest
- Operating System and version: iOS 9.0+
- Link to your project:
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
That one worked for me. Had the same issue as you. I think a new version for cocoapods is needed urgently.