Skip to content

LocalDateTime to Instant conversion incorrect for mingwX64 target after daylight savings in America/New_York on 0.6.0 #399

@kevincianfarini

Description

@kevincianfarini

In 2023, the conversion from EDT to EST happened at 2023-11-05T06:00:00Z in America/New_York. This was a shift backwards of one hour in local time. On JVM, Linux, and Apple targets this conversion is calculated properly. However, on the mingwX64 target, this time difference is improperly calculated. The following test fails on the Windows target, but passes for all other available targets.

@Test fun calculated_instant_is_correct() {
    val tz = TimeZone.of("America/New_York")
    val expected = Instant.parse("2023-11-05T07:00:00Z")
    val actual = LocalDateTime(year = 2023, monthNumber = 11, dayOfMonth = 5, hour = 2, minute = 0).toInstant(tz)
    assertEquals(expected, actual)
}

With the following error message

 io.github.kevincianfarini.cardiologist.SuspendingTests.calculated_instant_is_correct[mingwX64] FAILED
    kotlin.AssertionError: Expected <2023-11-05T07:00:00Z>, actual <2023-11-05T06:00:00Z>.

In case it's useful, here's a reference clock aligning UTC and America/New_York during the instant in question.

Metadata

Metadata

Assignees

Labels

timezoneThe model and API of timezones

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions