volto: Cannot set events with a user preferred time zone

Cross-posting from https://github.com/plone/plone.org/issues/141

It is not possible to create local events with a local time zone in plone.org or in the Volto demo, but I can in the Classic UI demo.

Classic UI Demo behavior

  • Login to https://classic.demo.plone.org/en as admin/admin.
  • Go to Date and Time control panel.
  • Observe the only available time zone is Europe/Berlin by default.
  • Add any time zone, such as America/Los_Angeles, and click Save.
  • Click Home to return home.
  • Create a new event. The event inherits the site’s default time zone.
  • Go to User Preferences, select the available time zone, America/Los_Angeles, and click Save.
Screenshot 2023-10-15 at 7 05 03 PM Screenshot 2023-10-15 at 7 04 58 PM

Plone.org and Volto Demo behavior

  • Repeat all the steps above. Observe that the User cannot set their preferences for a time zone, and must therefore rely upon the site preference for a time zone when creating events.

I don’t know whether this is a bug in Volto or some other dependency.

About this issue

  • Original URL
  • State: open
  • Created 8 months ago
  • Comments: 28 (17 by maintainers)

Most upvoted comments

@stevepiercy https://www.youtube.com/watch?v=XZlPXLsSU2U is a good fairly recent talk on handling timezones in Python, including the new zoneinfo module

@thet thanks for the package history. That helps. For convenience:

While digging, I also found this in pytz’s readme:

Projects using Python 3.9 or later should be using the support now included as part of the standard library, and third party packages work with it such as tzdata. pytz offers no advantages beyond backwards compatibility with code written for earlier versions of Python.

Plone 6.0 supports Python 3.8-3.11, so we can’t use only the Python standard library and drop pytz. Maybe in 6.1 we could do that. pytz currently supports up to Python 3.12.

I’d like to work on this, at least creating a design proposal or PLIP and being its champion, if not working the code.

Is it correct that until this feature is implemented in plone.app.event, it cannot be implemented in Volto?

if my preference is Europe/Berlin and the event was created in America/Los_Angeles the date-time in the event would be displayed in the America/Los_Angeles and not be converted to my preferred timezone

This is exactly what we want. In most use cases, the event’s time zone will be that of its location. One exception is where there is no physical location, such as online only events such as Plone Tune Ups. In that use case, it would probably be best for the admin to enable UTC and editors set the event start and end dates and times in UTC.

As an aside, did I just discover something that has been missing in Plone for all time? I think that relying on the user’s preferred or site’s default time zone setting is wrong, but this issue will work with what exists now in Plone. IMO both Classic UI and Volto should allow an editor to set the event’s time zone and location, regardless of their preferred time zone setting, instead of inheriting it from the user’s or site’s time zone setting. Thus I could create an event in the Eastern US time zone while residing in Pacific US time zone. The event would be displayed in its time zone, not the user’s or site’s.

We want to be able to schedule an event in a different time zone than the user’s browser, allowing the user to set a preferred time zone. The use cases include traveling outside one’s local time zone or scheduling an event that takes place outside one’s local time zone. The Volto implementation does not allow either use case, whereas Classic UI allows both. In America this is a serious problem, for example, where an organization is headquartered in the Eastern time zone but wants to schedule an event in the Pacific time zone.