Use Denver local time for scrape dates instead of UTC
Change default SCRAPER_TIMEZONE from UTC to America/Denver so that scrape date records (date_checked, daily summaries) reflect local time. A late-night manual scrape and early-morning automated scrape will no longer both report as the same UTC day. Updated getTodayUTC/getTodayDateUTC helpers to use toLocaleDateString with the configured timezone. ISO timestamps for last_scraped, first_seen, startedAt etc. remain in UTC as they represent precise moments.
This commit is contained in:
@ -50,15 +50,15 @@ describe('config/scraper', () => {
|
||||
});
|
||||
|
||||
describe('SCRAPER_TIMEZONE', () => {
|
||||
test('should default to "UTC" when env var not set', () => {
|
||||
test('should default to "America/Denver" when env var not set', () => {
|
||||
const config = require('../../config/scraper');
|
||||
expect(config.SCRAPER_TIMEZONE).toBe('UTC');
|
||||
expect(config.SCRAPER_TIMEZONE).toBe('America/Denver');
|
||||
});
|
||||
|
||||
test('should use env var override when set', () => {
|
||||
process.env.SCRAPER_TIMEZONE = 'America/Denver';
|
||||
process.env.SCRAPER_TIMEZONE = 'America/New_York';
|
||||
const config = require('../../config/scraper');
|
||||
expect(config.SCRAPER_TIMEZONE).toBe('America/Denver');
|
||||
expect(config.SCRAPER_TIMEZONE).toBe('America/New_York');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user