Skip to content

Conversation

@lauraneto
Copy link
Contributor

@lauraneto lauraneto commented Oct 16, 2025

Changes

  • Adjusted the Umbraco.DateTimeWithTimeZone editor to, when in Local mode, store the date as UTC in the database. This makes it so the stored data is consistent and does not vary depending on the time zone of the user viewing it.
  • Now not validating the "selected time zone" when mode is Local, as that will always be stored in UTC and not from a list.
  • Now checking if the expected value matches the stored value when loading the property, to trigger a change if needed to ensure the stored value is consistent. (this can happen if you change between editors, where a time zone was stored but is not relevant anymore, or if you switch from a All or Custom to Local, where the date should be stored in UTC)
  • Adjusted the value converter mappings to truncate the datetime whenever the editor was switched from one with more information to less (e.g. Date Time with Time Zone to Date Time Unspecified, 2025-10-10T00:00:00+02:00 -> 2025-10-10T00:00:00), as it was already the case when returning the date to the client.

Testing
For testing the initial reported issue, in which a validation error was shown when switching between All or Custom to Local and trying to publish the page:

  1. Create a document with a Date Time with Time Zone picker.
  2. Configure the picker to allow all time zones.
  3. Go to the document and select a date and a random time zone (that not your local) and publish the page.
  4. Go to the date time data type and change the Time zones to Local.
  5. Go back to the document and try to publish it.

I did end up fixing some other inconsistencies when changing between date time editors, so it would be nice to double check that the basic functionality of all 4 new date time editors still works as expected.

Copilot AI review requested due to automatic review settings October 16, 2025 12:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the DateTimeWithTimeZone property editor to store dates as UTC when configured in Local mode and to avoid invalid time zone validation in that mode.

  • Track the configured time zone mode and skip invalid time zone validation when in Local mode
  • Normalize saved value to UTC when in Local mode and adjust serialization logic
  • Rename and refactor date formatting helper to accept a DateTime to format

@lauraneto lauraneto requested a review from Copilot October 16, 2025 14:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

@lauraneto lauraneto requested a review from Copilot October 16, 2025 14:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

@lauraneto lauraneto force-pushed the v17/bugfix/date-time-changing-timezone-to-local-shows-invalid-time-zone-error branch from 943c354 to 645c8fd Compare October 16, 2025 15:03
…atch the stored value

This will happen when switching between editors (with and without time zone) or switching between a specific time zone to the editor's local time zone.
…rned in the value converter (when switching between editors)
@lauraneto lauraneto marked this pull request as ready for review October 17, 2025 12:17
@lauraneto lauraneto requested a review from Copilot October 17, 2025 12:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

@lauraneto lauraneto requested a review from Copilot October 17, 2025 14:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@lauraneto lauraneto requested a review from Copilot October 17, 2025 14:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

@lauraneto lauraneto requested a review from Copilot October 20, 2025 07:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good to me @lauraneto - I've verified the specific issue that triggered these changes and have done a few tests with different configuration, and all seems to work as expected. I'll leave you to merge or reach out for a review first from a front-ender if you feel that is going to be useful.

@lauraneto lauraneto merged commit e6f4879 into release/17.0 Oct 21, 2025
22 of 23 checks passed
@lauraneto lauraneto deleted the v17/bugfix/date-time-changing-timezone-to-local-shows-invalid-time-zone-error branch October 21, 2025 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants