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

Problem with date parsing #83

Open
sgermain06 opened this issue Jan 23, 2017 · 1 comment
Open

Problem with date parsing #83

sgermain06 opened this issue Jan 23, 2017 · 1 comment

Comments

@sgermain06
Copy link

sgermain06 commented Jan 23, 2017

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:
@apsoftware123
Copy link

"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.

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