Phase 18: Auto timezone detection and ability to change timezone #21
@@ -27,7 +27,7 @@ import { eq, sql } from 'drizzle-orm';
|
||||
import { db } from '../db/client.js';
|
||||
import { users, memberCredentials, calendars, appConfig } from '../db/schema.js';
|
||||
import { requireAdmin } from '../lib/requireAdmin.js';
|
||||
import { isValidIanaTimezone, getHouseholdTimezone } from '../lib/householdTimezone.js';
|
||||
import { isValidIanaTimezone, resolveHouseholdTimezone } from '../lib/householdTimezone.js';
|
||||
import {
|
||||
validateEncryptAndStoreCredential,
|
||||
CredentialValidationError,
|
||||
@@ -205,9 +205,9 @@ adminRouter.get('/config/timezone', async (c) => {
|
||||
.limit(1);
|
||||
|
||||
const isExplicitlySet = row?.value != null;
|
||||
const timezone = isExplicitlySet
|
||||
? (row.value as string)
|
||||
: await getHouseholdTimezone(db);
|
||||
// IN-01/IN-02: reuse the row we just SELECTed and let the centralized accessor apply
|
||||
// the D-06 fallback — no second app_config round-trip, single source for the policy.
|
||||
const timezone = resolveHouseholdTimezone(row?.value ?? null);
|
||||
|
||||
return c.json({ timezone, isExplicitlySet });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user