Skip to content

DateTimeUtils inconsistencies with default ZonedDateTime parsing. #1139

@cerveada

Description

@cerveada

parsing in admin/src/main/scala/za/co/absa/spline/admin/DateTimeUtils.scala

ZonedDateTime.parse allows both offset and name at the same time . I think it's good idea to accept all inputs that are valid for ZonedDateTime.parse

The issue with allowing only geographical zone id is that it is ambiguous. Not unique.

2022-10-30T02:30:00[Europe/Prague] is both:
2022-10-30T02:30+02:00[Europe/Prague]
2022-10-30T02:30+01:00[Europe/Prague]

This is the day and hour of change from summer time to winter time:

val start = ZonedDateTime.parse("2022-10-30T02:30:00+02:00[Europe/Prague]")
val end = start.plusHours(1)
// start: java.time.ZonedDateTime = 2022-10-30T02:30+02:00[Europe/Prague]
// end: java.time.ZonedDateTime =   2022-10-30T02:30+01:00[Europe/Prague]

Another interesting behaviour (not so relevant for us though) is this:

val start = ZonedDateTime.parse("2022-10-30T02:30:00+02:00")
val end = start.plusHours(1)
// start: java.time.ZonedDateTime = 2022-10-30T02:30+02:00
// end: java.time.ZonedDateTime   = 2022-10-30T03:30+02:00

When no geographical zone id is provided the ZonedDateTime will stay in the same offset.

  • defaultZoneId: ZoneId parameter is not use at all

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions