Skip to content

Timezone-aware local timestamps in all export filenames #165

@NickMonrad

Description

@NickMonrad

Problem

All export filenames that include a date currently use new Date().toISOString().slice(0, 10) which always produces a UTC date. This means users in UTC+10/+11 (e.g. AEST/AEDT) can receive files stamped with yesterday's date when exporting in the evening. Additionally, no exports include a time component, making it hard to distinguish multiple exports on the same day.

Proposed Solution

  1. Pass the user's local timezone from the browser to the server on export requests (via a query param, e.g. ?tz=Australia/Sydney)
  2. Format all export timestamps as YYYY-MM-DD HH-mm in the user's local timezone (colons replaced with hyphens for filesystem safety)
  3. Apply universally across all exports that currently have a date, and add timestamps to exports that currently have none

Affected Files & Locations

Server-side (date via query param ?tz=)

File Route Current format
server/src/routes/csv.ts:160 GET .../backlog/export-csv YYYY-MM-DD via toISOString()
server/src/routes/timeline.ts:1214 GET .../timeline/export/csv YYYY-MM-DD via toISOString()

Client-side (can use new Intl.DateTimeFormat directly)

File Export type Current format
client/src/pages/EffortReviewPage.tsx:228 Effort Summary/Detail CSV YYYY-MM-DD via toISOString()
client/src/pages/TimelinePage.tsx:296 Timeline CSV YYYY-MM-DD via toISOString()
client/src/pages/TimelinePage.tsx:351 Gantt PNG YYYY-MM-DD via toISOString()
client/src/pages/ResourceProfilePage.tsx:603 Resource Profile CSV No timestamp
client/src/pages/ResourceProfilePage.tsx:616 Project Export ZIP No timestamp

Server-side document download

File Route Current format
server/src/routes/documents.ts:87 GET .../documents/:docId/download No timestamp (label only)

Template exports (add timestamp for consistency)

File Export type Current format
server/src/routes/templates.ts:91 All templates CSV Static templates.csv
server/src/routes/templates.ts:258 Single template CSV Static {slug}.csv

Acceptance Criteria

  • A shared utility formatExportTimestamp(tz?: string): string returns YYYY-MM-DD HH-mm in the given IANA timezone (falls back to UTC if invalid/missing)
  • All server export routes accept an optional ?tz= query param and use it for the timestamp
  • All client export call sites pass tz= (Intl.DateTimeFormat().resolvedOptions().timeZone) as a query param
  • Client-only exports (Effort, Timeline CSV, Gantt PNG, Resource Profile, ZIP) use the same local timestamp format via a shared client utility
  • Document downloads include a local timestamp: {label} - YYYY-MM-DD HH-mm.{ext}
  • Template exports include a local timestamp: templates - YYYY-MM-DD HH-mm.csv / {slug} - YYYY-MM-DD HH-mm.csv
  • No export filename still uses raw toISOString() for its user-visible date/time

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogFuture enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions