- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.8k
Property Editors: DateTimeWithTimeZone - Changing timezone mode to Local shows invalid time zone error #20526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property Editors: DateTimeWithTimeZone - Changing timezone mode to Local shows invalid time zone error #20526
Conversation
…tored time zone is different
There was a problem hiding this 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
        
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this 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.
        
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this 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.
        
          
                src/Umbraco.Infrastructure/PropertyEditors/DateOnlyPropertyEditor.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                src/Umbraco.Infrastructure/PropertyEditors/TimeOnlyPropertyEditor.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                src/Umbraco.Infrastructure/PropertyEditors/DateTimeUnspecifiedPropertyEditor.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                src/Umbraco.Infrastructure/PropertyEditors/DateOnlyPropertyEditor.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      943c354    to
    645c8fd      
    Compare
  
    …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)
There was a problem hiding this 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.
        
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this 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.
There was a problem hiding this 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.
        
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...raco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/DateTimePropertyEditorTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...raco.Tests.Integration/Umbraco.Infrastructure/PropertyEditors/DateTimePropertyEditorTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this 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.
        
          
                ...I.Client/src/packages/property-editors/date-time/property-editor-ui-date-time-picker-base.ts
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this 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.
Changes
Umbraco.DateTimeWithTimeZoneeditor to, when inLocalmode, 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.Local, as that will always be stored in UTC and not from a list.AllorCustomtoLocal, where the date should be stored in UTC)Date Time with Time ZonetoDate 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
AllorCustomtoLocaland trying to publish the page:Time zonestoLocal.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.