Skip to content

Persist timestamps as UTC to preserve instants across UK DST transitions #817

Description

@StuartFerguson

Problem

Timestamp values are currently persisted as local DateTime values without an offset. This loses information during the UK autumn daylight-saving transition, when the local hour from 01:00 to 01:59 occurs twice.

For example:

  • 2026-10-25 01:30 +01:00 represents 00:30 UTC
  • 2026-10-25 01:30 +00:00 represents 01:30 UTC

A plain local DateTime cannot distinguish those two instants. Downstream APIs cannot reliably reconstruct the original instant and may return an incorrect DateTimeOffset.

Required changes

  • Review the timestamp fields written by this repository and identify those currently stored as local DateTime values.
  • Change persistence to retain the original instant, preferably by storing UTC.
  • Alternatively, persist the local value together with its original UTC offset.
  • Add the required database/entity/migration changes.
  • Update write/read mappings and any affected contracts or consumers.
  • Add tests covering:
    • Normal GMT timestamps.
    • Normal BST timestamps.
    • Both occurrences of the repeated autumn DST hour.
    • The spring DST transition.
  • Define how existing historical records are handled, noting that ambiguous historical local times cannot always be reconstructed without source data.

The service-wide reporting policy remains UK Europe/London; estate-specific timezones are out of scope.

This supports the reporting date/time standardisation work in EstateReportingAPI PR #615.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions