Skip to content

Fix Swedish date localization for ticket timestamps#49

Merged
simonforsberg merged 1 commit into
mainfrom
feature/date-localization
Apr 28, 2026
Merged

Fix Swedish date localization for ticket timestamps#49
simonforsberg merged 1 commit into
mainfrom
feature/date-localization

Conversation

@addee1

@addee1 addee1 commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

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

  • Bug Fixes
    • Updated date and time formatting in ticket views to use Swedish locale conventions, ensuring dates display according to Swedish standards for improved localization support.

@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The TicketViewDTO class has been updated to format date/time values using Swedish locale (sv-SE) instead of English locale when displaying ticket creation timestamps through the getFormattedCreatedAt() method.

Changes

Cohort / File(s) Summary
Locale Configuration
src/main/java/org/example/alfs/dto/ticket/TicketViewDTO.java
Updated DISPLAY_FORMATTER to use Swedish locale (sv-SE) instead of English for date/time formatting in the "dd MMM yyyy HH:mm" pattern.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 From London's tongue to Stockholm's way,
The dates now speak in Swedish display,
A single locale swap, quick and neat,
Makes Swedish months sound oh-so-sweet! 🇸🇪

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: replacing English locale with Swedish locale for ticket timestamp formatting.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/date-localization

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/java/org/example/alfs/dto/ticket/TicketViewDTO.java (1)

33-37: Consider timezone/user-local time vs LocalDateTime (pre-existing, but impacts user experience).

createdAt is a LocalDateTime, so getFormattedCreatedAt() 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/ZonedDateTime in the DTO layer (or converting before formatting) rather than formatting LocalDateTime directly.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2b85f68 and 7eea499.

📒 Files selected for processing (1)
  • src/main/java/org/example/alfs/dto/ticket/TicketViewDTO.java

@simonforsberg
simonforsberg merged commit 98a7ab3 into main Apr 28, 2026
3 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.

2 participants