Skip to content

Runtime fails to parse a valid ISO-8601 date #84

Closed
@m4p

Description

@m4p

Context:

While testing my application that uses with swift-openapi-generator, I noticed that the runtime fails to parse ISO 8601 / RFC3339 compatible dates that use fractional seconds. E.g. "created_at": "2012-10-30T19:49:28.123286Z". While RFC3339 calls these "rarely used" in my experience they aren't that uncommon. For releated discussion see here.

I'd propose adding a fallback DateFormatter that uses [.withInternetDateTime, .withFractionalSeconds] as formatOptions like I did here. If this is agreeable, I can send a pull request.

$ swift --version
swift-driver version: 1.75.2 Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0

$ uname -a
Darwin hayai.lan 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 arm64

My system has IPv6 enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions