Description
Title: Implement Robust Timezone Support with DST Transitions and Locale-Specific Date Formatting
Detailed Description:
CommitPulse's contribution tracking system has incomplete timezone handling, leading to inaccurate contribution counts when users span multiple timezones or when DST transitions occur. The current implementation treats all contributions with a single UTC baseline, failing to account for:
Background Problem:
Users with GitHub commits spanning multiple timezones see incorrect contribution aggregation
During DST transitions (spring forward/fall back), contributions are misaligned by 1 hour
The 3D visualization of contribution streaks displays incorrect data for users in non-UTC timezones
No locale-aware formatting for different calendar systems (Gregorian, Islamic, etc.)
Cached results don't account for timezone-based cache invalidation
This is particularly problematic for:
Remote teams across multiple countries
Users who relocated and maintained their GitHub account
International open-source projects with contributors across 180+ timezones
Accurate representation of "contribution days" which should be calculated per user's local timezone, not UTC
Objective:
Implement a comprehensive timezone and localization system that:
Automatically detects and stores user's primary timezone from GitHub profile or browser
Implements timezone offset calculation with automatic DST awareness
Recalculates contribution streaks using user's local timezone boundaries (not UTC day boundaries)
Provides accurate "contribution day" calculations regardless of timezone
Supports locale-specific date/time formatting (am/pm vs 24-hour, day-first vs month-first)
Implements timezone-aware cache invalidation strategies
Provides API endpoint for users to explicitly set their timezone
Handles edge cases like double DST transitions and historical timezone changes
Steps to Reproduce
Files to Check:
app/api/streak/route.ts
lib/utils/date-calculator.ts (if exists)
lib/graphql/queries/contributions.ts
lib/cache/ttl-cache.ts
types/contribution.ts
Expected Behavior
Implementation Details:
Integrate date-fns-tz or luxon for robust timezone handling
Create a timezone offset cache that accounts for historical DST rules
Implement "contribution day" boundaries calculation in user's local timezone
Add timezone field to user profile cache
Create middleware to auto-detect timezone from request headers (Cloudflare, etc.)
Implement locale-specific formatting utilities
Add timezone validation and conversion utilities for all date operations
Testing Requirements:
Test cases for all major timezones during DST transitions
Historical DST edge cases (countries that changed DST rules)
Contribution counting accuracy tests with simulated multi-timezone commits
Cache invalidation tests when user's timezone changes
Locale formatting tests for 20+ different locales
Performance tests for timezone conversions under load
Screenshots / Logs
No response
GitHub Username (If applicable)
No response
Environment
Chrome
Description
Title: Implement Robust Timezone Support with DST Transitions and Locale-Specific Date Formatting
Detailed Description:
CommitPulse's contribution tracking system has incomplete timezone handling, leading to inaccurate contribution counts when users span multiple timezones or when DST transitions occur. The current implementation treats all contributions with a single UTC baseline, failing to account for:
Background Problem:
Users with GitHub commits spanning multiple timezones see incorrect contribution aggregation
During DST transitions (spring forward/fall back), contributions are misaligned by 1 hour
The 3D visualization of contribution streaks displays incorrect data for users in non-UTC timezones
No locale-aware formatting for different calendar systems (Gregorian, Islamic, etc.)
Cached results don't account for timezone-based cache invalidation
This is particularly problematic for:
Remote teams across multiple countries
Users who relocated and maintained their GitHub account
International open-source projects with contributors across 180+ timezones
Accurate representation of "contribution days" which should be calculated per user's local timezone, not UTC
Objective:
Implement a comprehensive timezone and localization system that:
Automatically detects and stores user's primary timezone from GitHub profile or browser
Implements timezone offset calculation with automatic DST awareness
Recalculates contribution streaks using user's local timezone boundaries (not UTC day boundaries)
Provides accurate "contribution day" calculations regardless of timezone
Supports locale-specific date/time formatting (am/pm vs 24-hour, day-first vs month-first)
Implements timezone-aware cache invalidation strategies
Provides API endpoint for users to explicitly set their timezone
Handles edge cases like double DST transitions and historical timezone changes
Steps to Reproduce
Files to Check:
app/api/streak/route.ts
lib/utils/date-calculator.ts (if exists)
lib/graphql/queries/contributions.ts
lib/cache/ttl-cache.ts
types/contribution.ts
Expected Behavior
Implementation Details:
Integrate date-fns-tz or luxon for robust timezone handling
Create a timezone offset cache that accounts for historical DST rules
Implement "contribution day" boundaries calculation in user's local timezone
Add timezone field to user profile cache
Create middleware to auto-detect timezone from request headers (Cloudflare, etc.)
Implement locale-specific formatting utilities
Add timezone validation and conversion utilities for all date operations
Testing Requirements:
Test cases for all major timezones during DST transitions
Historical DST edge cases (countries that changed DST rules)
Contribution counting accuracy tests with simulated multi-timezone commits
Cache invalidation tests when user's timezone changes
Locale formatting tests for 20+ different locales
Performance tests for timezone conversions under load
Screenshots / Logs
No response
GitHub Username (If applicable)
No response
Environment
Chrome