react-timezone-select icon indicating copy to clipboard operation
react-timezone-select copied to clipboard

GMT+00 Casablanca is in the wrong time zone

Open alex-airbox opened this issue 2 years ago • 6 comments

Describe the bug

Casablanca appears as GMT+0, but currently it is in +1. I noticed that issue is probably with timezone-soft as they report it as UTC+00, but my browser renders any time set to Africa/Casablanca as UTC+01

Edit: Actually timezone-soft seems correct, this is what it reports. Morocco is most of the year in standard (UTC+1), with the daylight used during Ramadan but that ended the 1st Sunday of May.

Is it just that react-timezone-select uses the long name provided by this timezone-soft?

{
    "name": "Morocco Standard Time",
    "iana": "Africa/Casablanca",
    "standard": {
        "abbr": "WET",
        "offset": 1,
        "name": "Morocco Standard Standard Time"
    },
    "daylight": {
        "abbr": "WEST",
        "offset": 0,
        "name": "Western European Summer Time",
        "start": "last-sun-mar-3h",
        "end": "1st-sun-may-2h"
    },
    "long": "(UTC+00:00) Casablanca"
}

image

Reproduction

https://ndom91.github.io/react-timezone-select/

System Info

Your own demo, browsed on Chrome/windows (latest)

Used Package Manager

npm

Validations

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

alex-airbox avatar Jun 06 '23 14:06 alex-airbox

Hey thanks for bringing this up. So it looks like the info we're getting from timezone-soft is correct, but we're just not rendering the correct one (daylight savings vs. non-daylight savings times)? Did I understand that correctly?

ndom91 avatar Jun 07 '23 13:06 ndom91

Yeah the option rendered says GMT +0:00, yet the timezone right now in Casablanca is GTM+1 (https://www.timeanddate.com/worldclock/morocco/casablanca)

Not sure where the issue is, but the response from timezone-soft says "long": "(UTC+00:00) Casablanca", is that what you use to render the label? Because that long name is not correct.

alex-airbox avatar Jun 07 '23 14:06 alex-airbox

Hmm yeah no so we stitch together the standard.offset, standard.abbr, or the daylight variant. Depending on whether spacetime.now('Africa/Casablanca').isDST() returns true or false.. :thinking:

ndom91 avatar Dec 10 '23 14:12 ndom91

Same issue here btw: https://github.com/ndom91/react-timezone-select/issues/83

Where determining when DST is occuring / whether to use daylight/standard values is being incorrectly calculated :thinking:

ndom91 avatar Dec 10 '23 14:12 ndom91

Hi @ndom91 - we just noticed the same thing; it looks like this is due to the underlying use of spacetime. See https://github.com/spencermountain/spacetime/issues/402

Spacetime isn't DST aware.

emrysal avatar Mar 11 '24 16:03 emrysal