messaging: timestamps render in UTC instead of local time #188

Open
opened 2026-04-29 13:25:29 +00:00 by rawdaGastan · 0 comments
Member

Problem

Message bubble timestamps show UTC rather than the user's local time. With local clock at 15:40 EEST (UTC+3), bubbles displayed 12:40. Same goes for the relative-time helper for older buckets.

Where

archipelagos/messaging/src/islands/mod.rsformat_time and (relevant for the day rollover) format_relative_time:

pub fn format_time(timestamp: u64) -> String {
    if timestamp == 0 { return String::new(); }
    let secs = timestamp / 1000;
    let hours = (secs / 3600) % 24;   // ← UTC, no TZ adjustment
    let minutes = (secs / 60) % 60;
    format!("{:02}:{:02}", hours, minutes)
}

Closed #76 fixed a similar bug in contacts (format_timestamp treats Unix seconds as days). Same module-level pattern, different file.

Suggested fix

Use js_sys::Date on wasm32 and chrono::Local on native to convert before formatting. Likely belongs in hero_archipelagos_core::platform next to format_date so all islands share it.

Found via QA session 2026-04-29.

## Problem Message bubble timestamps show UTC rather than the user's local time. With local clock at 15:40 EEST (UTC+3), bubbles displayed `12:40`. Same goes for the relative-time helper for older buckets. ## Where `archipelagos/messaging/src/islands/mod.rs` — `format_time` and (relevant for the day rollover) `format_relative_time`: ```rust pub fn format_time(timestamp: u64) -> String { if timestamp == 0 { return String::new(); } let secs = timestamp / 1000; let hours = (secs / 3600) % 24; // ← UTC, no TZ adjustment let minutes = (secs / 60) % 60; format!("{:02}:{:02}", hours, minutes) } ``` ## Related Closed #76 fixed a similar bug in contacts (`format_timestamp treats Unix seconds as days`). Same module-level pattern, different file. ## Suggested fix Use `js_sys::Date` on `wasm32` and `chrono::Local` on native to convert before formatting. Likely belongs in `hero_archipelagos_core::platform` next to `format_date` so all islands share it. Found via QA session 2026-04-29.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_archipelagos#188
No description provided.