Skip to content

Conversation

@cnaples79
Copy link
Contributor

Summary

  • Fixes UTC timestamp being treated as local time in Allegro OneBox tracking
  • Times are now correctly converted from UTC to the user's local timezone

Changes Made

  • Modified AllegroOneBoxDeliveryService.kt to use Instant.parse() + LocalDateTime.ofInstant()
  • This matches the pattern used in other services like BelpostDeliveryService and CainiaoDeliveryService
  • Removed unused DateTimeFormatter import

Technical Details

The API returns timestamps in ISO 8601 format with UTC timezone (e.g., 2024-01-15T10:30:00Z). Previously, LocalDateTime.parse() was used which ignores the timezone suffix and interprets the time as local. Now we properly parse it as an Instant (UTC) and convert to local time.

Test Plan

  • Tested that the code compiles correctly
  • The fix follows the same pattern as localDateFromMilli() in Core.kt

Fixes #187

The API returns UTC timestamps but they were being parsed as local time
using LocalDateTime.parse(). This caused times to be displayed incorrectly
for users not in the UTC timezone.

Fixed by using Instant.parse() to properly interpret the UTC timestamp,
then converting to local time using LocalDateTime.ofInstant() with the
system's default timezone.

Fixes itsvic-dev#187
Copy link
Owner

@itsvic-dev itsvic-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@itsvic-dev itsvic-dev merged commit 5510249 into itsvic-dev:master Dec 8, 2025
2 checks passed
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.

allegro onebox tracking shows incorrect time

2 participants