fix(backup-ui): respect general_date_format + general_time_format

The four backup admin panes (BackupHistory, BackupDashboard,
BackupCoverageCard, BackupIntegrityCard) used raw date-fns
`format()` with hard-coded tokens like 'p' (12-hour AM/PM), 'PP',
'PPP', 'PPp', and 'yyyy-MM-dd HH:mm:ss' — ignoring the admin's
configured `general_date_format` and `general_time_format`
settings.

Net effect on a 24h-configured install: backup History row showed
"11:25 PM" instead of "23:25", and the Coverage tab's "Last dump"
+ "Coverage generated" timestamps were stuck on
yyyy-MM-dd HH:mm:ss regardless of the admin's date-format choice.

All four panes now route through `useLocalizedDate()` which honors
both settings + the active i18n locale (per the existing
[[feedback_respect_general_format_settings]] pattern).

Tokens replaced:
  format(date, 'p')              → formatTime(date)
  format(date, 'PP')             → format(date)
  format(date, 'PPP')            → format(date)
  format(date, 'PPp')            → formatDateTime(date)
  format(date, 'yyyy-MM-dd HH:mm:ss') → formatDateTime(date)
  format(date, 'yyyy-MM-dd HH:mm')    → formatDateTime(date)

No backend changes — settings already shipped via /admin/settings;
this just makes the consumers actually read them.
This commit is contained in:
Luca
2026-05-31 23:33:50 +02:00
parent 83fdb47fbf
commit 09f6a1af6a
5 changed files with 57 additions and 20 deletions
+21 -5
View File
@@ -1000,11 +1000,27 @@ END $$;`
await reinitPool();
this.log('info', 'Knex pool re-initialized');
// Run migrations to ensure schema is up to date. Use the
// module-level `db` export, which is the Proxy that now points
// at the freshly-initialized pool.
this.log('info', 'Running database migrations...');
await db.migrate.latest();
// NOTE: we deliberately do NOT call `db.migrate.latest()` here.
//
// The picpeak migrations directory contains `helpers.js` (a
// shared helper module, not a migration), plus `core/` and
// `legacy/` subdirectories. Knex's built-in migrator scans the
// top-level directory and rejects any file without `up`/`down`
// exports — so `db.migrate.latest()` throws
// Invalid migration: helpers.js must have both an up and down function
// every time it runs in this codebase. The production code path
// uses `npm run migrate:safe` (run-migrations-safe.js) which
// knows to skip helpers.js + walks core/ explicitly.
//
// For restore: the dump we just loaded already contains the
// schema state of whatever migrations had been applied at
// backup time. If the running image has NEWER migrations that
// need to run on top of the restored DB, those will be applied
// on the NEXT container start by wait-for-db.sh + the safe
// runner. That's a one-restart penalty in the unusual case of
// restoring from a backup older than the current image, and
// matches what picpeak does on every other boot already.
this.log('info', 'Skipping in-process migrate (deferred to next boot via safe runner)');
// Replay the snapshotted operator-meta settings on top of the
// restored DB. UPSERT by setting_key — if the backup had the