coderedcms icon indicating copy to clipboard operation
coderedcms copied to clipboard

Error with generating single .ical

Open Sreini opened this issue 1 year ago • 3 comments

https://github.com/coderedcorp/coderedcms/blob/9591169c8ada8119773fc6bd37a9be5618324882/coderedcms/views.py#L142

I'm getting an error message when using the "generate single ical" button:

image

The values being passed don't seem unreasonable:

image

But digging a bit deeper, it seems that they are a problem: the code expects a timezone to be generated, but this doesn't seem to be the case: image

It seems its a problem that the datetime here is "naive" (idk what that means) but for this reason parsing this datetime isn't working well, as the parser expects a timezone.

I am not knowledgeable enough about python to know what the best solution is here, but hopefully someone who does can take the last step and solve this issue for everyone!

Sreini avatar Dec 04 '23 13:12 Sreini

Hello - the error message here means that your event page is missing the start and end times. Can you double check that event in the Wagtail admin and ensure it has start and end datetimes set?

Regarding timezones... a "naive" datetime simply means a datetime without a timezone. For example: November 1, 2023 at 8am. If you see this date, you don't know if that means 8am eastern time, pacific time, UTC, etc. The opposite of this is an "aware" datetime, which has the timezone, for example: November 1, 2024 at 8am EST.

As a best practice, you ALWAYS want to use timezones to avoid these kinds of problems. Django will handle this for you automatically if you set USE_TZ=True and set TIME_ZONE in the Django settings.

vsalvino avatar Dec 04 '23 18:12 vsalvino

Yes. as you can see in the second image the datetimes are set. I even debugged to make sure that they are indeed passed into the method. Setting USE_TZ=True did resolve the error though

Sreini avatar Dec 04 '23 18:12 Sreini

Glad that worked. I suppose we should update the docs to specify that the calendar only works with time zone support enabled.

vsalvino avatar Dec 04 '23 18:12 vsalvino