feat(ui): use timezone-aware time formatting across all templates
Replace hardcoded .Format() calls with FormatInTimezone() and FormatTimestamptzInTimezone() helpers so all timestamps display in the user's selected timezone. Changes: - book_detail.templ: remove incorrect templates. package prefix - book_detail_modals.templ: add User param to ProgressSyncModal so timezone is available; convert Timestamp to FormatInTimezone() - devices.templ: convert LastSync and LastSeen to FormatInTimezone() - conflicts.templ: convert CreatedAt to FormatInTimezone() - admin_users.templ: convert CreatedAt to FormatInTimezone() using currentUser.Timezone Note: DatePublished is kept as a plain date format (MM-DD-YYYY) since it is a pgtype.Date, not a timestamp, and does not need timezone conversion.
This commit is contained in:
@@ -80,7 +80,7 @@ templ Devices(user User, devices []handlers.DeviceInfo, pendingRegistrations []P
|
||||
<div class="flex justify-between">
|
||||
<span style="color: var(--text-secondary)">Last Sync</span>
|
||||
if device.LastSync != nil {
|
||||
<span style="color: var(--text-primary)">{ device.LastSync.Format("01-02-2006 03:04 PM") }</span>
|
||||
<span style="color: var(--text-primary)">{ FormatInTimezone(*device.LastSync, user.Timezone) }</span>
|
||||
} else {
|
||||
<span style="color: var(--text-primary)">Never</span>
|
||||
}
|
||||
@@ -88,7 +88,7 @@ templ Devices(user User, devices []handlers.DeviceInfo, pendingRegistrations []P
|
||||
<div class="flex justify-between">
|
||||
<span style="color: var(--text-secondary)">Last Seen</span>
|
||||
if device.LastSeen != nil {
|
||||
<span style="color: var(--text-primary)">{ device.LastSeen.Format("01-02-2006 03:04 PM") }</span>
|
||||
<span style="color: var(--text-primary)">{ FormatInTimezone(*device.LastSeen, user.Timezone) }</span>
|
||||
} else {
|
||||
<span style="color: var(--text-primary)">Never</span>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user