Skip to content

Add support for all world timezones in Digital Clock #2134

Open

Description

@ash1shkumar

Problem Statement

Currently, the Digital Clock project supports only a limited number of predefined timezones, which restricts users from viewing accurate time for many regions around the world. The existing timezone selection experience is also limited and not scalable for global users.


Proposed Solution

Enhance the Digital Clock project by dynamically adding support for all world timezones using the JavaScript Intl.supportedValuesOf('timeZone') API.

Implementation Plan

  1. Fetch all supported timezones dynamically:
const timezones = Intl.supportedValuesOf("timeZone");
  1. Populate timezone dropdown automatically:
timezones.forEach((zone) => {
  const option = document.createElement("option");
  option.value = zone;
  option.textContent = zone;
  timezoneSelect.appendChild(option);
});
  1. Detect and preselect user's local timezone:
Intl.DateTimeFormat().resolvedOptions().timeZone
  1. Update clock according to selected timezone:
const time = new Date().toLocaleTimeString("en-US", {
  timeZone: selectedZone,
});
  1. Improve user experience:
  • Add searchable timezone dropdown
  • Improve dropdown UI styling
  • Ensure responsiveness across devices
  1. Optional enhancement:
  • Display UTC/GMT offsets beside timezone names
  • Save recently selected timezone using localStorage

Alternatives Considered

  • Manually adding popular timezones one by one (not scalable and difficult to maintain)
  • Using third-party timezone libraries (unnecessary for this use case since modern browsers already support the Intl API)

Additional Context

Benefits

  • Complete global timezone support
  • Better user experience and accessibility
  • Automatic local timezone detection
  • Cleaner and more scalable implementation
  • Improves functionality of the Digital Clock project

Notes

  • Uses native JavaScript Intl API for efficient implementation
  • Maintains compatibility with existing clock functionality
  • Improves scalability without major code complexity

I have read the CONTRIBUTING.md guidelines carefully and would like to work on this enhancement under GSSoC'26.

Image

Activity

  1. github-actions commented on May 18, 2026

    @github-actions
    Contributor

    Thank you for raising this issue! We'll look into it as soon as possible. Please ensure that the issue is not duplicate, and you read CONTRIBUTING.md carefully. Your contributions are highly appreciated! 😊

  2. ash1shkumar commented on May 18, 2026

    @ash1shkumar
    Author

    Hi @dhairyagothi , I would like to work on this enhancement under GSSoC'26.
    I have read the CONTRIBUTING.md guidelines carefully. Please assign this issue to me.

  3. ash1shkumar commented on May 18, 2026

    @ash1shkumar
    Author

    Hi @dhairyagothi , I have completed the implementation of this issue's PR #2144 regarding adding support for all world timezones in the Digital Clock project. Kindly review my PR. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions