Skip to content

Leap seconds with positive UTC offsets are not detected #69

Closed

Description

@PHJ2000

These timestamps describe the same known leap second, but only the UTC form produces LeapSecondException:

ITU.parseDateTime("2016-12-31T23:59:60Z");
// LeapSecondException, verified=true

ITU.parseDateTime("2017-01-01T00:59:60+01:00");
// DateTimeException: Invalid value for SecondOfMinute (valid values 0 - 59): 60

The second call should also throw LeapSecondException with verified=true and a nearest date-time representing 2017-01-01T00:00:00Z. Positive fractional offsets such as +05:30 fail too.

DateTimeValidator checks the local year/month/day and subtracts offset hours and minutes separately. The leap-second boundary needs to be checked after converting the complete date-time to UTC, as described in RFC 3339 §5.7: https://www.rfc-editor.org/rfc/rfc3339#section-5.7

Reproduced with 1.16.0 and main at 3ef79bd.

AI assistance: OpenAI Codex investigated and reproduced this issue and drafted this report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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