Skip to content

fix: handle ISO timestamps with time zones - #236

Open
Agroqirax wants to merge 1 commit into
itsvic-dev:masterfrom
Agroqirax:tz-fix
Open

Agroqirax wants to merge 1 commit into
itsvic-dev:masterfrom
Agroqirax:tz-fix

Conversation

@Agroqirax

Copy link
Copy Markdown
Contributor

Follow-up to #235.

GLS Netherlands mixes two timestamp shapes in one response:

"scans": [{ "dateTime": "2026-08-17T07:47:32" }],
"deliveryStatus": { "etaTimestamp": "2026-08-17T11:26:00+02:00" }

LocalDateTime.parse() with no formatter uses ISO_LOCAL_DATE_TIME, which rejects the
offset. The DateTimeParseException hits the catch-all in MainActivity and the parcel
shows an error instead of tracking info. The deliveryStatus block only exists while a
parcel is out for delivery, which is why it wasn't caught earlier.

Adds localDateFromISO() to Core.kt:

  • Offset or zone present -> converted to the device's TZ
  • Absent -> local time as before

Applied it to every service parsing an ISO timestamp. One other, Ukrposhta, had the same
issue; nine silently dropped the offset and showed carrier wall-clock time; five already
did it correctly by hand and are now just shorter. Cainiao (deliberately uses the parcel's
own zone), UPS, and the non-ISO parsers are untouched.

Tests cover offsetless, fractional seconds, +02:00, Z and a bracketed zone. Unit suite
and assembleDebug pass, ran ktfmt.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant