json-schema-org / website

JSON Schema website
https://json-schema.org
Other
67 stars 177 forks source link

fix: Incorrect Times/Timezones when fetching events #1060

Open techmannih opened 1 month ago

techmannih commented 1 month ago

What kind of change does this PR introduce? Fixing a Bug, Incorrect Times/Timezones when fetching events from the Community calendar #1036 Issue Number: Issue #1036

Screenshots/videos: image

techmannih commented 1 month ago

@DhairyaMajmudar @benjagm please review

DhairyaMajmudar commented 1 month ago

@techmannih the build and lint workflows are failing, pls. fix them

github-actions[bot] commented 1 month ago
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview 4b493c58902dd5c60be12a0a0beadb1254545e73
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (718dab5) to head (4b493c5).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1060 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 10 10 Lines 373 373 Branches 94 94 ========================================= Hits 373 373 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

techmannih commented 1 month ago

@techmannih the build and lint workflows are failing, pls. fix them

sure, please check now

techmannih commented 1 month ago

@benjagm but in the calender these are different, Please clarify whether the time on the calendar is in the local time zone or in UTCimage

benjagm commented 2 weeks ago

Please clarify whether the time on the calendar is in the local time zone or in UTC

We have 2 alternatives:

Whatever we decide we need the times the be consistent.

DarhkVoyd commented 2 weeks ago

IMO, the schedule would be better displayed in 24-hour UTC, its easier and clearer to understand for most.

gregsdennis commented 2 weeks ago

Just display both user-local and UTC.

benjagm commented 2 weeks ago

@techmannih, any update on this one? We'd love to fix this asap.

techmannih commented 2 weeks ago

Hey @benjagm, on fetching the data it's show on local time zone and for America/los_angles timezone makes difficulties to converting in utc

benjagm commented 2 weeks ago

Hey @benjagm, on fetching the data it's show on local time zone and for America/los_angles timezone makes difficulties to converting in utc

Forget about local timezones. The calendar data has the original timezones associated to the events. You need to find that original timezones (I shared the details in previous comments) and then just convert to UTC accordingly.

Again, forget about local timezones.

techmannih commented 2 weeks ago

Hey @benjagm

1. JSON Schema Open Community Working Meetings is stored int the calendar in Europe/London timezone which is also in UTC

(London is in UTC during the winter months (October to March), and during the summer months (April to September), London is in UTC+1 (British Summer Time), so the time difference is 1 hour.)

2. JSON Schema Office Hours (Europe/Americas) is stored in Europe/London timezone which is also in UTC

(London is in UTC during the winter months (October to March), and during the summer months (April to September), London is in UTC+1 (British Summer Time), so the time difference is 1 hour.)

3. JSON Schema Office Hours (APAC/Americas) (America/Los_Angeles Time Zone)

(Los Angeles follows Pacific Standard Time (PST) during the winter months (typically November to March), which is UTC -8:00. During the summer months (April to October), Los Angeles follows Pacific Daylight Time (PDT), which is UTC -7:00.)

We can fix the time for Europe/London timezone in UTC, but for the America/Los_Angeles timezone, we need to determine the correct local time based on your needs, as the time difference will vary depending on the season (whether it's Standard Time or Daylight Saving Time).

benjagm commented 2 weeks ago

We can fix the time for Europe/London timezone in UTC, but for the America/Los_Angeles timezone, we need to determine the correct local time based on your needs, as the time difference will vary depending on the season (whether it's Standard Time or Daylight Saving Time).

Great progress!!! Congrats.

We'll use Daylight Saving Time.

techmannih commented 2 weeks ago

11:00 PM PDT in Los Angeles would be 6:00 AM UTC (the next day), is it correct ?

benjagm commented 2 weeks ago

11:00 PM PDT in Los Angeles would be 6:00 AM UTC (the next day), is it correct ?

Please note that Pacific Daylight Time (PDT) is a North American time zone in use only between the second Sunday in March to the first Sunday in November during Daylight Saving Time (DST). The rest of the year the timezone is PST Pacific Standard Timezone (PC), therefore now they are in PST.

benjagm commented 2 weeks ago

Sidenote about Office Hours (APAC/Americas) (America/Los_Angeles Time Zone) because here you provided some details that are not correct:

  1. JSON Schema Office Hours (APAC/Americas) (America/Los_Angeles Time Zone) Local Time (America/Los_Angeles Time Zone): 11:00 PM – 12:00 AM

The correct time in the calendar is 3 pm Pacific Time / PT

See screenshot:

Screenshot 2024-11-10 at 08 41 15
techmannih commented 2 weeks ago

Sidenote about Office Hours (APAC/Americas) (America/Los_Angeles Time Zone) because here you provided some details that are not correct:

The correct time in the calendar is 3 pm Pacific Time / PT

Thanks @benjagm for confirming, But I am getting these times in the calendar for the events. image

If these are incorrect, please give me actual and correct time for all event and UTC time also

benjagm commented 2 weeks ago

Not sure about your data and how it appears in your browser/calendar.

This is what I see (My timezone is CET)

Screenshot 2024-11-10 at 10 32 02

Remember that we are reading the ical file that is a text file from here https://calendar.google.com/calendar/ical/json.schema.community%40gmail.com/public/basic.ics. In this case this is the data available there:

JSON Schema Open Community Working Meeting

BEGIN:VEVENT
DTSTART;TZID=Europe/London:20240916T200000
DTEND;TZID=Europe/London:20240916T210000
SUMMARY:JSON Schema Open Community Working Meeting

JSON Schema Office Hours (Europe/Americas)

BEGIN:VEVENT
DTSTART;TZID=Europe/London:20240604T150000
DTEND;TZID=Europe/London:20240604T160000
SUMMARY:JSON Schema Office Hours (Europe/Americas)
END:VEVENT

JSON Schema Office Hours (APAC/Americas)

BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20240702T150000
DTEND;TZID=America/Los_Angeles:20240702T160000
SUMMARY:JSON Schema Office Hours (APAC/Americas)
END:VEVENT

Don't get confuse about how the data appears in your google calendar. Focus on the ical file, how this is converted to JSON and what JSON you have to work with.

techmannih commented 2 weeks ago

@benjagm Thanks for sharing this data; it's very helpful for understanding. The difference between CET and UTC is 1 hour, so according to UTC timings:

Please confirm if these are correct. If not, kindly provide the correct UTC timings.

benjagm commented 2 weeks ago

Looks good to me!

techmannih commented 2 weeks ago

Thank you, @benjagm, for confirming! I’ve made the updates, and it looks much better now.

image

benjagm commented 2 weeks ago

Yes!! Can you please add the changes to the logic in the community page?

We have some duplicity of code and this will be a great opportunity to do some refactoring to avoid duplicate code, if that is possible.

techmannih commented 2 weeks ago

Sure @benjagm How's look? image

I’ve made the updates, and it looks much better now.

benjagm commented 2 weeks ago

and it looks much better now.

Looking good. Are you going to do some code reformatting to avoid duplicity in the calendar parsing logic?

techmannih commented 2 weeks ago

@benjagm please check now

techmannih commented 1 week ago

@benjagm @DarhkVoyd please check now