Time unification

This commit is contained in:
2026-06-17 15:06:38 -04:00
parent 069a44bd54
commit 54a2460eac
67 changed files with 1442 additions and 1329 deletions
+17 -1
View File
@@ -23,6 +23,17 @@ const IMPORT_STOCK_SNAPSHOTS = true;
const INCREMENTAL_UPDATE = process.env.INCREMENTAL_UPDATE !== 'false'; // Default to true unless explicitly set to false
// SSH configuration
// Current UTC offset of America/Chicago ('-05:00' or '-06:00'), DST-aware.
function currentChicagoOffset() {
const tzName = new Intl.DateTimeFormat('en-US', {
timeZone: 'America/Chicago',
timeZoneName: 'longOffset',
})
.formatToParts(new Date())
.find((p) => p.type === 'timeZoneName').value; // e.g. 'GMT-05:00'
return tzName.replace('GMT', '') || '+00:00';
}
const sshConfig = {
ssh: {
host: process.env.PROD_SSH_HOST,
@@ -40,7 +51,12 @@ const sshConfig = {
password: process.env.PROD_DB_PASSWORD,
database: process.env.PROD_DB_NAME,
port: process.env.PROD_DB_PORT || 3306,
timezone: '-05:00', // mysql2 driver timezone — corrected at runtime via adjustDateForMySQL() in utils.js
// DATETIMEs on this server store Central wall-clock. Use the CURRENT
// Chicago offset (DST-aware) so both inbound parsing and outbound
// serialization are correct in winter (CST=-06:00) and summer
// (CDT=-05:00). adjustDateForMySQL() in utils.js remains as a runtime
// safety net (its correction is 0 when this offset matches the server).
timezone: currentChicagoOffset(),
},
localDbConfig: {
// PostgreSQL config for local