feat (timezone): normalization function for handling legacy timezone identifiers#3633
Merged
mikecao merged 1 commit intoumami-software:masterfrom Sep 24, 2025
Merged
Conversation
… to 'Asia/Kolkata' and updating validation schema to use normalized timezones.
|
@mcnaveen is attempting to deploy a commit to the umami-software Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
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_MAPPINGSconstant andnormalizeTimezone()function insrc/lib/date.ts - Updated
isValidTimezone()to validate normalized timezone names - Modified
timezoneParamschema 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
2 files reviewed, no comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance timezone handling by adding normalization for 'Asia/Calcutta' to 'Asia/Kolkata' and updating validation schema to use normalized timezones.
Closes: #3632