Skip to content

Set the API's time zone to Los Angeles for report dates - #63

Merged
ericnost merged 1 commit into
version4-2024-0from
api-timezone-los-angeles
Nov 11, 2026
Merged

ericnost merged 1 commit into
version4-2024-0from
api-timezone-los-angeles

Conversation

@ejanalysis

Copy link
Copy Markdown
Contributor

Report dates: use the Los Angeles time zone on the API server.

Reports built by the API say "Report created on " in the footer. That date comes from the server's clock, and Cloud Run runs on UTC, so a report made after 7 pm Eastern shows tomorrow's date. This was seen on 2026-11-10 with the v4.2024.0 test API: a report made in the evening, US time, said November 11.

The EJAM app's own reports already use the user's browser time zone, falling back to America/Los_Angeles (EJAM R/app_server.R, date_in_user_timezone()). The API has no browser to ask, so this sets the same fallback for the whole API container.

Changes (Dockerfile only):

  • ENV TZ=America/Los_Angeles, set before the system packages are installed.
  • Adds tzdata to the system packages, so R can use that setting. Without it, R stays on UTC.

Effect: every mainland US user sees today's date until midnight in Los Angeles (3 am Eastern). Nothing else in the API depends on the time zone that I could find; logs on Cloud Run carry their own UTC timestamps.

Base branch: version4-2024-0, so it can go into the v4 build. The same two lines would also suit the v3.2022.3 archive build.

To check after a build: request any report as HTML in the evening, US time, and confirm the footer shows today's date. Or run Sys.timezone() / format(Sys.time(), "%Z") in the container; it should report PST/PDT.

Decided by the EJAM maintainer on 2026-11-10 (EJAM issue Public-Environmental-Data-Partners/EJAM#681, section C4). Not built or deployed by me.

— Claude (AI assistant), posting from ejanalysis account

🤖 Generated with Claude Code

Cloud Run runs on UTC, so the "Report created on" date in API-built
reports showed tomorrow's date after 7 pm Eastern. America/Los_Angeles
matches the EJAM app's fallback time zone. Also installs tzdata so R
can use the setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ericnost ericnost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. I recall previously having a time zone setting (Chicago?) in the Dockerfile, not sure where it went. Users working late on the east coast will get the wrong timestamp, but it's unavoidable and not a huge deal.

@ericnost
ericnost merged commit 1d90be1 into version4-2024-0 Nov 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants