# PLIP plone/Products.CMFPlone#4115: Enhance timezone support in UI for `plone.a…pp.event` based types
(Transferred from https://github.com/plone/volto/pull/5629)
## Responsible Persons
- Steve Piercy @stevepiercy
- Add your name and GitHub username
### Proposer: Steve Piercy @stevepiercy
### Seconder: Johannes Raggam @thet
## Abstract
Event content types, or events, have incomplete implementations and sometimes slightly different implementations between the two Plone frontends, Classic UI and Volto. This PLIP proposes to improve the implementations to be more complete and consistent.
In Volto, the event content type does not display a timezone. When visitors are located or travel across multiple time zones, they cannot determine whether the event's time zone is their own local one, the site's default, the author's setting, or the event's location's. This is particularly confusing when an event has online participation, or when participants travel across time zones. In sites that serve its visitors in only one time zone, this is not an issue.
In Classic UI, the event contact type displays only those timezones that have been made available by the Site Administrator.
The history of event content types is in the [`plone.app.event` package](https://github.com/plone/plone.app.event). However it was implemented using `pytz` whereas the standard library `zoneinfo` and `datetime` with an optional third-party package `tzdata` are now recommended for Python 3.9 and later. From the [`pytz` readme](https://pypi.org/project/pytz/):
> 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](https://pypi.org/project/tzdata/). `pytz` offers no advantages beyond backwards compatibility with code written for earlier versions of Python.
Plone 6.0 supports Python 3.9-3.13. Plone 6.1 supports Python 3.10-3.13. Now that Python 3.8 support has been dropped, we can use the standard library and `tzdata` instead. Plone 6.2 is expected to be released in Q3 2025. Plone 7.0 is expected to be released in Q2 2026. See [Plone Release Schedule](https://plone.org/download/release-schedule).
See also [PEP 615 – Support for the IANA Time Zone Database in the Standard Library](https://peps.python.org/pep-0615/) and [Talk - Benjamin "Zags" Zagorsky: Handling Timezones in Python](https://www.youtube.com/watch?v=XZlPXLsSU2U).
Several other related minor issues may be addressed as part of this PLIP.
## Motivation
Everyone wants to have a good time with a date. 😉
`zoneinfo` is preferred over `pytz` since Python 3.9.
International audiences expect events to be held at a given date and time with a timezone designation. Consistency between the two frontends makes it easier to transition when upgrading Plone or migrating to Volto.
Several issues, either added as sub-issues to this PLIP or as tracked issues, relate to the event content type, date, time, and timezone implementations.
## Assumptions
- Timezone support. Every event has a timezone. Do not support naive datetimes, that is, a datetime without a timezone.
## Proposal and Implementation
This PLIP is targeted for completion in Plone 7.0. Some bugs may be fixed in Plone 6.2.
In Classic UI, inputs for events should continue to use the [Patterns Lib datetime picker](https://github.com/Patternslib/Patterns/tree/master/src/pat/datetime-picker) with an HTML5 [datetime-local](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local) input as fallback, which in turn falls back to an input type of text.
In Classic UI, evaluate [dependencies of `plone.app.event`](https://5.docs.plone.org/external/plone.app.event/docs/architectural-overview.html#packages) to determine whether they should be kept or replaced.
In Volto, decide whether to continue to use its [datetime widget](https://6.docs.plone.org/storybook/?path=/story/edit-widgets-datetime--datetime)—which consists of two text inputs, one each for the date and the time—or use a different implementation. The current implementation requires either keyboard input or an excessive number of clicks to select a specific month or year that is distant from the default. From https://github.com/plone/volto/issues/2392#issuecomment-2136547074, there is a plan to move to [React Aria](https://react-spectrum.adobe.com/react-aria/index.html), and we could use its [calendar component](https://react-spectrum.adobe.com/react-aria/useCalendar.html#styled-examples) with a [styled calendar input with month and year selectors](https://codesandbox.io/p/sandbox/affectionate-rosalind-tdm323?file=%2Fsrc%2FCalendar.js).
See Deliverables and the Project Board for details of the implementation.
### Exclusions
There are other issues that do not involve the event content type, but are related to date, time, and timezone issues. These issues are not part of this PLIP, but are mentioned to make it clear that they are out of scope.
- https://github.com/plone/plone.restapi/pull/1192
- https://github.com/collective/volto-form-block/issues/76
## Deliverables
All the tracked pull requests and issues, the sub-issues at the end of this PLIP, and the following items.
### Tracked pull requests and issues
- https://github.com/Patternslib/Patterns/issues/1038
- https://github.com/plone/volto/issues/6690
- https://github.com/plone/volto/issues/6652
### Planning and design
- [ ] [Design document](https://docs.google.com/document/d/1I8cW_rctvciJg-tjYVgLauhlDCJVoot53wEyV3igoxw/edit)
- [ ] Migration of [`plone.app.event` documentation](https://5.docs.plone.org/external/plone.app.event/docs/index.html) from Plone 5 to Plone 6.
- [ ] Documentation of upgrade steps.
- [x] Plone REST API needs to return a timezone in its event endpoint for the start and end attributes. See: https://6.docs.plone.org/plone.restapi/docs/source/endpoints/content-types.html#event
- [ ] Add `<date>` and `<time>` HTML markup for date and time values when displayed.
- [ ] Use an appropriate fallback of HTML5 `<input type="TYPE">`, where `TYPE` is either [`<input type="date">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date), [`<input type="time">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time), or [`<input type="datetime-local">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local).
- [ ] Ensure that Publish and Expiration Dates have times.
- [ ] Upgrade steps need to be considered for all objects that have a date or time.
- [ ] Volto detects the timezone of the user's browser and attempts to display dates for that local timezone. This may interfere with setting and displaying the correct time for an event content type. Ideally browser detection shenanigans would be dropped, and the display would rely upon the value stored in the backend and show the event's timezone. This implementation would remove all ambiguity over when the event occurs.
- [ ] The user and site preferences would be fallbacks, when no timezone is selected when creating an event. In other words, timezone order of preference would be: Event > User > Site.
- [ ] In the Date and Time control panel, add an option to toggle the display of timezones of events at the site level. The default would be "Don't display timezones of events", with the other option of "Display timezones of events".
- [ ] Add support for anywhere on earth (AoE) as a date. The event would be saved with a start datetime of yyyy-mm-dd 00:00:00 UTC+14 and an end datetime of the next day plus 2 hours less 1 second (yyyy-mm-dd +1d 01:59:59 UTC+14) because there is an overlap of two hours in the Pacific Ocean where the timezone UTC-12 is observed. That's right, there are 50 hours in a day. 🤯 See [Time Zone Map](https://www.timeanddate.com/time/map/) and [Time Zone Converter](https://www.timeanddate.com/worldclock/converter.html?iso=20240118T100000&p1=3399&p2=274).
- Event: "whole day" and "open end" have no effect [Volto plone/volto#3243](https://github.com/plone/volto/issues/3243)
- [ ] Whole day events. When a user enters a date, they may check a box to make it an whole day event so that they do not have to enter a start and end time, although the system will save the event with the start time of 00:00:00 and end time of 23:59:59.
- [ ] Open end events. When a user enters a date, they may check a box to make it an open end event, so that they do not have to enter an end date or time.
## Project board
https://github.com/orgs/plone/projects/43/views/1
## Risks
Switching from `pytz` to the Python 3.9 or greater standard library and `tzdata` may cause compatibility issues. This was addressed in https://github.com/plone/plone.app.event/pull/419.
[Dependencies of `plone.app.event`](https://5.docs.plone.org/external/plone.app.event/docs/architectural-overview.html#packages) might need to be upgraded or replaced.
Returning a datetime with a timezone might cause issues in Volto, `plone.restapi`, and `plone.app.event`.
Removing detection of the browser's timezone in Volto may break entry and display of dates.
## Participants
- Steve Piercy, @stevepiercy, Lead Cat Herder
- Johannes Raggam, @thet, contributor
- Giulia Ghisini, @giuliaghisini, contributor
- Timo Stollenwerk, @tisto, reporter
- Ishaan Dasgupta, @IshaanDasgupta, contributor
- Your name, GitHub username, Role