Changeset 421c2d4 in Klonkt for src/routes


Ignore:
Timestamp:
06/21/2026 04:48:27 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
d6bdbae
Parents:
9effb80
Message:

feat(instellingen): site timezone — all dates + scheduling in chosen zone

Admin → Settings gets a Timezone picker (IANA, validated via Intl; empty =
server/UTC). Applied to: server-side date display (formatDate/formatDateTime
receive timeZone), and post scheduling (datetime-local is now interpreted/shown
in the site's zone instead of browser-local — wall↔UTC via Intl offset).
'Scheduled for' shows the time in the site's zone. NL/EN/DE.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/admin-settings.js

    r9effb80 r421c2d4  
    116116      setSetting('default_lang', SUPPORTED.includes(dl) ? dl : '');
    117117    }
     118    if (typeof req.body.timezone !== 'undefined') {
     119      // Site-tijdzone (IANA, bv. Europe/Amsterdam). Leeg = server-default (UTC).
     120      // Valideer met Intl zodat een onzin-waarde nooit de datum-rendering breekt.
     121      const tz = (req.body.timezone || '').toString().trim();
     122      let valid = '';
     123      if (tz) { try { Intl.DateTimeFormat('en-US', { timeZone: tz }); valid = tz; } catch { valid = ''; } }
     124      setSetting('timezone', valid);
     125    }
    118126    if (typeof req.body.hub_title !== 'undefined') {
    119127      setSetting('hub_title', (req.body.hub_title || '').toString().slice(0, 80).trim());
Note: See TracChangeset for help on using the changeset viewer.