diff --git a/services/targo-hub/lib/campaigns.js b/services/targo-hub/lib/campaigns.js index 503c7de..94a892c 100644 --- a/services/targo-hub/lib/campaigns.js +++ b/services/targo-hub/lib/campaigns.js @@ -1132,7 +1132,7 @@ async function sendCampaignAsync (id) { let expiresInDays = '' if (r.gift_expires_at) { const exp = new Date(r.gift_expires_at) - expiresAtDate = exp.toLocaleDateString(expiryLocale, { day: 'numeric', month: 'long', year: 'numeric' }) + expiresAtDate = exp.toLocaleDateString(expiryLocale, { day: 'numeric', month: 'long', year: 'numeric', timeZone: 'America/Montreal' }) const days = Math.max(0, Math.ceil((exp - new Date()) / 86400000)) expiresInDays = String(days) } @@ -1830,7 +1830,7 @@ async function handle (req, res, method, path) { // as its main urgency line; without it the test email shows an // empty space where the date should be. const sampleExpAt = new Date(Date.now() + 30 * 86400 * 1000) - .toLocaleDateString('fr-CA', { day: 'numeric', month: 'long', year: 'numeric' }) + .toLocaleDateString('fr-CA', { day: 'numeric', month: 'long', year: 'numeric', timeZone: 'America/Montreal' }) const vars = { firstname: 'Louis', lastname: 'Test', @@ -1878,7 +1878,7 @@ async function handle (req, res, method, path) { const body = await parseBody(req) const html = body.html || fs.readFileSync(templatePath(tplPreview[1]), 'utf8') const sampleExpAt = new Date(Date.now() + 30 * 86400 * 1000) - .toLocaleDateString('fr-CA', { day: 'numeric', month: 'long', year: 'numeric' }) + .toLocaleDateString('fr-CA', { day: 'numeric', month: 'long', year: 'numeric', timeZone: 'America/Montreal' }) const vars = { firstname: 'Louis', lastname: 'Paul', email: 'louis@targo.ca', description: '123 Rue de Test', gift_url: 'http://gtbt.co/PREVIEW', @@ -1998,7 +1998,7 @@ async function handle (req, res, method, path) { let expiresInDays = '' if (r.gift_expires_at) { const exp = new Date(r.gift_expires_at) - expiresAtDate = exp.toLocaleDateString(expiryLocale, { day: 'numeric', month: 'long', year: 'numeric' }) + expiresAtDate = exp.toLocaleDateString(expiryLocale, { day: 'numeric', month: 'long', year: 'numeric', timeZone: 'America/Montreal' }) const days = Math.max(0, Math.ceil((exp - new Date()) / 86400000)) expiresInDays = String(days) }