coderedcorp / coderedcms

Wagtail + CodeRed Extensions enabling rapid development of marketing-focused websites.
https://www.coderedcorp.com/cms
Other
668 stars 137 forks source link

Error with generating single .ical #612

Open Sreini opened 7 months ago

Sreini commented 7 months ago

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!

vsalvino commented 7 months ago

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.

Sreini commented 7 months ago

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

vsalvino commented 7 months ago

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