thooyork / thooClock

jQuery analogue AlarmClock Plugin
MIT License
30 stars 17 forks source link

Support timezone with minutes offsets #16

Closed krislao closed 5 years ago

krislao commented 5 years ago

Hi @thooyork ! Thanks for creating a great jQuery clock plugin. I've been using this for a current project and noticed that it lacks support for timezones with minutes offsets. There's also an existing issue about this. Kindly review my proposed implementation. :smiley:

Proposed solution will support timezones such as:

  1. (UTC+04:30) | Kabul
  2. (UTC-04:30) | Caracas
  3. (UTC+06:30) | Yangon (Rangoon)
  4. (UTC+05:30) | Chennai, Kolkata, Mumbai, New Delhi
  5. (UTC+03:30) | Tehran
  6. (UTC+05:45) | Kathmandu

The idea is to retain your original code and just added new functions minutesCorrection and timeCorrection. To accommodate minutes offsets, they are to be converted to hours (e.g. 30 mins -> 0.50hr, 45 mins -> 0.75hr) to retain the format needed for hourCorrection options property. For example, if the selected timezone is GMT +9:30 and the current timezone is GMT +8:00, the hourCorrection will have the value +1.50.

~ Kris ~

thooyork commented 5 years ago

Merged minute offset in timezones