Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 24, 2025

This PR implements timezone persistence across page loads by extending the existing URL parameter system to include selected timezones, enabling users to share specific timezone configurations and have their selections persist across browser sessions.

✨ New Feature: Timezone Persistence Across Page Loads

Users can now share timezone configurations via URL and have their timezone selections automatically restored when the page loads.

🔧 Technical Implementation

URL Parameter Format:

  • ?timezones=America%2FNew_York,Europe%2FLondon,Asia%2FTokyo
  • Supports multiple timezones separated by commas
  • Properly URL-encoded timezone identifiers
  • Preserves existing parameters (theme, mode, timeFormat)

Key Features:

  • Automatic persistence: Adding/removing timezones updates URL immediately
  • Page load restoration: URL timezones are restored when page loads
  • Shareable URLs: Users can share timezone configurations via URL
  • Graceful fallbacks: Invalid timezones are ignored, falls back to defaults
  • Parameter preservation: Works alongside existing settings (theme, mode, timeFormat)

🧪 Testing Coverage

Added comprehensive test suite (timezone-url-persistence.test.ts) covering:

  • URL parameter parsing (single and multiple timezones)
  • URL encoding/decoding scenarios
  • Invalid timezone handling
  • URL updates on add/remove operations
  • Integration with existing settings parameters

📸 Working Demo

Timezone Persistence Demo

The screenshot shows the working timezone persistence with multiple timezones loaded from URL parameters, each with remove buttons for easy management.

🔗 Example URLs

Multiple Timezones:

http://localhost:8000/?timezones=America%2FNew_York,Europe%2FLondon,Asia%2FTokyo

With Theme Settings:

http://localhost:8000/?theme=neon-cyber&mode=light&timezones=America%2FLos_Angeles,Europe%2FParis

🛠️ Changes Made

  • Extended TimelineManager: Added URL parameter parsing and updating methods
  • URL Integration: Seamlessly integrates with existing settings URL parameters
  • Test Coverage: Added 11 comprehensive tests ensuring robust functionality
  • Minimal Changes: Surgically precise implementation following existing patterns

All tests pass ✅ (115/115) and the implementation follows the existing codebase patterns for maximum compatibility.

Fixes #89.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

- Add URL parameter handling for selected timezones in TimelineManager
- Implement timezone parsing from URL on initialization
- Add automatic URL updates when timezones are added/removed
- Preserve existing URL parameters (theme, mode, timeFormat) when updating timezones
- Add comprehensive test suite for timezone URL persistence
- Support URL encoding/decoding of timezone identifiers
- Enable shareable timezone configurations via URL

Co-authored-by: tsmarvin <[email protected]>
Copilot AI changed the title [WIP] Timezones persist across loads feat: implement timezone selection persistence in URL parameters Jul 24, 2025
Copilot AI requested a review from tsmarvin July 24, 2025 23:55
Copilot finished work on behalf of tsmarvin July 24, 2025 23:55
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.

Timezones persist across loads

2 participants