lostcarpark/conclar

Improvements to timezone handling

Closed this issue · 3 comments

This issue covers a number of improvements to the way ConClár handles timezones.

  • Change from old style JavaScript date functions to use the Temporal API. Initially this uses the js-temporal/polyfill library, but eventually when browsers introduce native support, this can be dropped.
  • Change to store dates and times in UTC in a combined datetime object internally. This should allow more consistent handling of dates in the final display
  • Add a config option to specify whether date and time are in convention local time, or in UTC. This will allow better support for systems like Planorama, which stores dates in UTC internally.
  • Allow program data to populate a single datetime field instead of separate date and time fields, in "20220517T163000" format. This will make it easier for systems that store date and time in a single field to generate output. The KonOpas format of separate date and time fields will still be supported.
  • Change local time conversion to explicitly fetch the local timezone name from the browser, and use that when converting to local time.
  • Display the local time zone name in the "show local time" control.
  • Allow user selection of local timezone through settings page. This will allow the local timezone to be overridden if the browser selection is not correct for any reason. Settings like 12 hour time and show local time, and other future user settings would be added to this settings page.

I have been working on the "select local timezone" change.
Currently I'm using a component called "timezone-select-js", which provides a select control for selecting the timezone.
Unfortunately, this control clashes with other components used by the project, so I'm having to use npm install --force to install it. I'm hoping I can either get the issues with this component fixed, or find another component to use to resolve.
The local timezone selection part of the change will have to stay in a separate branch until this can be resolved.

Edit: Switched to a different component, "react-timezone-select", which has resolved the above issue.

I have created pull request #98.
This contains all of the above changes.
I had originally planned to add a config item to allow dates to be specified in UTC. However, this proved unnecessary, as UTC dates can be specified by using YYYY-MM-DDThh:mm:ss+00:00 in the input file.
I will leave the pull request open for a few days for review as it's a big change.

All the issues listed here should be covered by PR #98, so I'm closing this issue.