-
Couldn't load subscription status.
- Fork 205
Description
Describe the bug
On Swift 6.3 (aka nightly-main branch), comparing two dates expressing the same moment in time returns false, where it used to return true before.
To Reproduce
@main
struct TestDate {
static func main() throws {
#if canImport(FoundationEssentials)
let dateString = "2020-01-13T09:25:40.621Z"
let d1 = try Date(dateString, strategy: Date.ISO8601FormatStyle(includingFractionalSeconds: true))
let d2 = Date(timeIntervalSince1970: 1_578_907_540.621)
if d1 != d2 {
fatalError("The two dates should be identical. Got \(d1) and \(d2)")
}
print("Test OK")
#else
print("This test code runs with FoundationEssentials only, try running it on Linux.")
print("✅ To test on Swift 6.2:")
print("👉 docker run -v $(pwd):/app -w /app --rm swift:6.2 bash -c \"swift run\"")
print("❌ To test on Swift 6.3:")
print("👉 docker run -v $(pwd):/app -w /app --rm swiftlang/swift:nightly-main bash -c \"swift run\"")
#endif
}
}Expected behavior
On Swift <=6.2, this test returns true.
On Swift 6.3 (nightly-main branch), it returns false.
Configuration (please complete the following information):
Docker images:
✅ swift:6.2
❌ swift:nightly-main
Regression information:
Works with Foundation and FoundationEssentials on Swift <= 6.2
Additional context
awslabs/swift-aws-lambda-events#102
I suspect this change to be the cause of this problem
https://github.com/swiftlang/swift-foundation/pull/1533/files