mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
63c94fa961
Implement the "Time Preference" section of the player preferences (issue #198), which until now was stored in DB but never applied in-game. procMtime() — the central date/time formatter used across reports, messages, notices and troop movements — now honours the per-user settings: - timezone: the stored value is mapped to a DateTimeZone, either a named DST-aware region (Europe, UK, Turkey, Kolkata, Bangkok, New York, Chicago, New Zealand) or a fixed UTC offset (general zones); timestamps are converted before formatting. - tformat: drives the date layout and 12h/24h clock (0=EU dd.mm.yy 24h, 1=US mm/dd/yy 12h, 2=UK dd/mm/yy 12h, 3=ISO yy/mm/dd 24h). tformat 0 keeps the previous EU output unchanged. The today/yesterday sentinels are preserved (callers compare them) and are computed in the player's timezone. The time-only path (mode 9) stays 24h H:i:s because it feeds the live JS clock counters (unx.js), which parse "H:i:s" by splitting on ":". A few alliance/report/farm-list rows that combined procMtime's day part with a raw date('H:i') now take the time from the same procMtime result, to avoid mixing timezones. A second "local time" clock is shown next to the server-time one: a small vanilla-JS snippet emitted once from menu.tpl finds the visible #tp1 clock and appends a row ticking in the player's timezone (Date.now() + UTC offset), independent of the browser timezone and of the unx.js counters. It aligns the value under the server time, is skipped when the player's timezone matches the server's, and lets the clock box grow so the extra row fits the frame. Adds the LOCAL_TIME string (EN/FR/RO). When no player session is available (admin / pre-login) procMtime falls back to the server timezone and EU layout, i.e. the previous behaviour. Removes the last "not coded yet" tag from the preferences form. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>