Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12104] ISO8601DateFormatter fails to parse "2013-11-01T00:00.00Z" #4480

Open
swift-ci opened this issue Jan 29, 2020 · 4 comments
Open

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-12104
Radar rdar://problem/58999127
Original Reporter gkaindl (JIRA User)
Type Bug

Attachment: Download

Environment

Swift 5.1.3

Date: December 13, 2019
Tag: swift-5.1.3-RELEASE

on Ubuntu 18.04

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 2edc9a53797eff6716707dfa50f8b190

relates to:

  • SR-13218 Swift's ISO8601DateFormatter doesn't parse all valid RFC3339 dates

Issue Description:

See the attached test.swift file, which (correctly) prints "Optional(2013-11-01 00:00:00 +0000)" on macOS 10.14 and macOS 10.15, but prints "nil" on Linux.

Since the test program is so short, I'll also include it here:

import Foundation

let formatter = ISO8601DateFormatter()
let date = formatter.date(from: "2013-11-01T00:00.00Z")

print(date as Any)

Unfortunately, I currently do not have a fully debuggable environment set up on Linux, but only caught this problem through a unit test (I'm developing on macOS).

The unit test includes a lot of other date strings that are all parsed correctly, but this particular one always evaluates to nil.

@weissi
Copy link
Member

weissi commented Jan 29, 2020

confirmed:

$ for f in 5.0 5.1 5.2 master; do jw-docker-swift-$f swift date.swift; done
nil
nil
nil
nil
$ swift date.swift  ## macOS
Optional(2013-11-01 12:00:00 am +0000)

@weissi
Copy link
Member

weissi commented Jan 29, 2020

CC @millenomi/@spevans

@spevans
Copy link
Collaborator

spevans commented Jan 29, 2020

Testing with corelibs-foundation on macOS it does actually work so I suspect this is a difference between Apple's ICU fork and regular ICU. The decimal point seems to be the actual issue so it might be possible to do a work around. However dates ending in a .00Z format don't not seem to be officially supported according to the list https://developer.apple.com/documentation/foundation/iso8601dateformatter/1643324-formatoptions

@beccadax
Copy link
Contributor

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants