Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: event timezones not standardized #59

Closed
asimonson1125 opened this issue Oct 26, 2021 · 7 comments
Closed

bug: event timezones not standardized #59

asimonson1125 opened this issue Oct 26, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@asimonson1125
Copy link

Describe the bug
When an event has a specific TZID, either because the event was added from a different calendar or by user's decision to manually change the timezone, recurring-ical-events fails to convert the date times to adjust for the unusual timezone, leaving the processed time to be inaccurate.

To Reproduce
make a calendar event with a timezone different than the one in the calendar header. Resulting raw event DT might look like this:
DTSTART;TZID=America/New_York:20211102T110000
then load the calendar and print out event['DTSTART']

@asimonson1125 asimonson1125 added the bug Something isn't working label Oct 26, 2021
@niccokunzmann
Copy link
Owner

Hi @asimonson1125, thanks for reporting this... To be sure that we talk about the same thing ... could you post a whole ics file which can show the issue? The next steps are the tests, then...

@niccokunzmann niccokunzmann added wontfix This will not be worked on and removed wontfix This will not be worked on labels Dec 24, 2021
@asimonson1125
Copy link
Author

asimonson1125 commented Dec 28, 2021

Hi @asimonson1125, thanks for reporting this... To be sure that we talk about the same thing ... could you post a whole ics file which can show the issue? The next steps are the tests, then...

Sure, here's an example. It's in a txt file because that is what github will let me upload, but the contents are the same:
broken.txt
It isn't formatted exactly the same as the originally reported example, but the error remains the same. I believe Google updated their calendar exports since my intial report to standardize timezones about GMT so I'm struggling to determine where exactly the date is being displayed incorrectly.

This was my test:

import urllib.request
import recurring_ical_events
import datetime
import icalendar
import arrow


# Gets calendar from ICS file ------------------------------------------------------
#f = open("broken.ics", 'r')
#calendario = icalendar.Calendar.from_ical(f.read())
#f.close()
myUrl = "https://calendar.google.com/calendar/ical/c_grbi06ec0hl1s9gi46c3ooqvsc%40group.calendar.google.com/public/basic.ics"
ical_string = urllib.request.urlopen(myUrl).read()
calendario = icalendar.Calendar.from_ical(ical_string)


# --------------------------------------------------------------------------------------------


events = recurring_ical_events.of(calendario).between(datetime.datetime(2021, 12, 22), datetime.datetime(2021, 12, 23) + datetime.timedelta(days=2)) 

for i in range(len(events)): # For each event in the next 2 days...
    eName = events[i]['SUMMARY'] # Event name in string
    eStart = events[i]['DTSTART'].dt # Event start time in dt
    eEnd = events[i]['DTEND'].dt # Event end time in dt
    print(eName, "\n\tStarts: ", eStart, "\n\tDuration: ", eEnd - eStart, '\n')

and output:

Google says this is 9PM to 10PM on 12/22/2021 
	Starts:  2021-12-23 02:00:00+00:00 
	Duration:  1:00:00 

Google recognizes this as EST 5PM-6PM 
	Starts:  2021-12-22 22:00:00+00:00 
	Duration:  1:00:00 

Google Calendar says this is noon to 1PM on 12/22/2021 
	Starts:  2021-12-22 17:00:00+00:00 
	Duration:  1:00:00 

@niccokunzmann
Copy link
Owner

niccokunzmann commented Dec 29, 2021

To me, this looks like X-WR-TIMEZONE is involved, #53. You are person 3 to report a different expected behaviour. It could well be that there should be a uniform way of handling X-WR-TIMEZONE.

@niccokunzmann
Copy link
Owner

I opened #71 to discuss it because you are not the only one facing this.

@niccokunzmann
Copy link
Owner

What do you think?

@asimonson1125
Copy link
Author

I do not have enough experience with ics's to make a hypothesis. I suspect there are multiple problems that were fixed or changed over the course of error reporting (see: my change from the initial report due to google's change in handling), so all I can say is that any tests need to my carefully version controlled.

@niccokunzmann
Copy link
Owner

@asimonson1125 Would you like to give it a try with the latest version? I believe, since X-WR-TIMEZONE support is integrated now, the times should be reported at the mentioned times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants