Fix Swedish date localization for ticket timestamps#49
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/org/example/alfs/dto/ticket/TicketViewDTO.java (1)
33-37: Consider timezone/user-local time vsLocalDateTime(pre-existing, but impacts user experience).
createdAtis aLocalDateTime, sogetFormattedCreatedAt()formats the stored date-time without any timezone conversion. If “created at” is stored in UTC (or server time), Swedish users may still see the “wrong” clock time for their timezone—even though the language/months are correct.If the intended behavior is “display in the viewer’s timezone”, consider storing/using
Instant/ZonedDateTimein the DTO layer (or converting before formatting) rather than formattingLocalDateTimedirectly.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/org/example/alfs/dto/ticket/TicketViewDTO.java` around lines 33 - 37, getFormattedCreatedAt currently formats the LocalDateTime field createdAt directly (using DISPLAY_FORMATTER) which ignores timezones; update the DTO to either store a timezone-aware type (Instant or ZonedDateTime) or convert createdAt from a known source zone (e.g., UTC) to the viewer's ZoneId before formatting. Concretely, change TicketViewDTO to (a) prefer an Instant or ZonedDateTime for createdAt and format via createdAt.atZone(viewerZone).format(DISPLAY_FORMATTER) or (b) if keeping LocalDateTime, treat it as UTC and implement getFormattedCreatedAt(ZoneId viewerZone) that does createdAt.atZone(ZoneOffset.UTC).withZoneSameInstant(viewerZone).format(DISPLAY_FORMATTER); ensure DISPLAY_FORMATTER is compatible with ZonedDateTime/Instant formatting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/main/java/org/example/alfs/dto/ticket/TicketViewDTO.java`:
- Around line 33-37: getFormattedCreatedAt currently formats the LocalDateTime
field createdAt directly (using DISPLAY_FORMATTER) which ignores timezones;
update the DTO to either store a timezone-aware type (Instant or ZonedDateTime)
or convert createdAt from a known source zone (e.g., UTC) to the viewer's ZoneId
before formatting. Concretely, change TicketViewDTO to (a) prefer an Instant or
ZonedDateTime for createdAt and format via
createdAt.atZone(viewerZone).format(DISPLAY_FORMATTER) or (b) if keeping
LocalDateTime, treat it as UTC and implement getFormattedCreatedAt(ZoneId
viewerZone) that does
createdAt.atZone(ZoneOffset.UTC).withZoneSameInstant(viewerZone).format(DISPLAY_FORMATTER);
ensure DISPLAY_FORMATTER is compatible with ZonedDateTime/Instant formatting.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f5e8b45e-ab30-40a8-8bf1-dd39573cded7
📒 Files selected for processing (1)
src/main/java/org/example/alfs/dto/ticket/TicketViewDTO.java
Updated ticket date formatting to use Swedish locale instead of English.
This improves localization by displaying timestamps in a format better suited for Swedish users across the ticket view.
Summary by CodeRabbit
Release Notes