Skip to content

Comments

feat (timezone): normalization function for handling legacy timezone identifiers#3633

Merged
mikecao merged 1 commit intoumami-software:masterfrom
mcnaveen:fix/asia-kolkata-tz
Sep 24, 2025
Merged

feat (timezone): normalization function for handling legacy timezone identifiers#3633
mikecao merged 1 commit intoumami-software:masterfrom
mcnaveen:fix/asia-kolkata-tz

Conversation

@mcnaveen
Copy link
Contributor

Enhance timezone handling by adding normalization for 'Asia/Calcutta' to 'Asia/Kolkata' and updating validation schema to use normalized timezones.

Closes: #3632

… to 'Asia/Kolkata' and updating validation schema to use normalized timezones.
@vercel
Copy link

vercel bot commented Sep 24, 2025

@mcnaveen is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR fixes timezone handling by adding normalization for legacy timezone identifiers. The implementation adds a mapping from Asia/Calcutta to Asia/Kolkata and updates both validation and schema transformation to use normalized timezone names.

  • Added TIMEZONE_MAPPINGS constant and normalizeTimezone() function in src/lib/date.ts
  • Updated isValidTimezone() to validate normalized timezone names
  • Modified timezoneParam schema to transform legacy timezones during validation
  • Addresses the issue where pageview endpoints were failing due to legacy timezone identifiers from Intl.supportedValuesOf('timeZone')

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Simple, well-targeted fix that addresses a specific compatibility issue. The changes are minimal, focused, and maintain backward compatibility while fixing the validation problem. No complex logic or edge cases introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename        Score        Overview
src/lib/date.ts 5/5 Added timezone normalization mapping and function to handle legacy 'Asia/Calcutta' timezone identifier
src/lib/schema.ts 5/5 Updated timezone validation schema to transform legacy timezone identifiers to modern equivalents

Sequence Diagram

sequenceDiagram
    participant Client as Client Request
    participant Schema as Schema Validation
    participant Normalize as normalizeTimezone()
    participant Validate as isValidTimezone()
    participant Intl as Intl.DateTimeFormat

    Client->>Schema: timezone: "Asia/Calcutta"
    Schema->>Validate: isValidTimezone("Asia/Calcutta")
    Validate->>Normalize: normalizeTimezone("Asia/Calcutta")
    Normalize-->>Validate: "Asia/Kolkata"
    Validate->>Intl: DateTimeFormat({timeZone: "Asia/Kolkata"})
    Intl-->>Validate: Valid ✓
    Validate-->>Schema: true
    Schema->>Normalize: transform("Asia/Calcutta")
    Normalize-->>Schema: "Asia/Kolkata"
    Schema-->>Client: Normalized timezone accepted
Loading

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

Copy link
Member

@mikecao mikecao left a comment

Choose a reason for hiding this comment

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

💯

@mikecao mikecao merged commit eca6b06 into umami-software:master Sep 24, 2025
1 of 7 checks passed
@mcnaveen mcnaveen deleted the fix/asia-kolkata-tz branch September 24, 2025 19:57
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.

Pageview endpoint failing because of legacy timezone identifiers

2 participants