coderedcorp/coderedcms

Error with generating single .ical

Sreini opened this issue · 4 comments

Sreini commented

def event_generate_single_ical_for_event(request):

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!

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

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

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

Added docs with 4.1