Skip to content

iso8601 formatter with RFC3339 is too restrictive #131

@marcblanchet

Description

@marcblanchet
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime

this formatOption restricts to RFC3339 format. That format requires timezone. Sometimes the timezone is not included, therefore results in error.
I manage to create a custom formatter instantiating
let formatter = ISO8601DateFormatter()
formatter.formatOptions = [.withColonSeparatorInTime, .withDashSeparatorInDate, .withFullDate, .withTime]
which supports strings without timezone, but for strings with timezone, the timezone is lost in the resulting date.

would be good that the parser will be more liberal in accepting date strings

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions