resolving conflicts, merging down lost hotfix 2.134 --> develop#1568
Open
JoshuaVulcan wants to merge 1 commit into
Open
resolving conflicts, merging down lost hotfix 2.134 --> develop#1568JoshuaVulcan wants to merge 1 commit into
JoshuaVulcan wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR merges in a hotfix that ensures existing events’ initial formData has date-time/time fields normalized to the user’s current timezone during SchemaForm initialization, preventing timezone-offset inconsistencies.
Changes:
- Add
getFormDataWithFixedTimezonesutility to recursively timezone-normalize DATE_TIME/TIME fields (including inside collections). - Update
SchemaForminitialization to apply timezone correction for existing events (while keeping default-value initialization for new events). - Add/extend unit tests covering timezone correction behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/ReportManager/DetailsSection/SchemaForm/utils/getFormDataWithFixedTimezones/index.js | New utility to recursively correct timezone formatting for DATE_TIME/TIME fields in formData. |
| src/ReportManager/DetailsSection/SchemaForm/utils/getFormDataWithFixedTimezones/index.test.js | New tests for the timezone-correction utility, including nested collection scenarios. |
| src/ReportManager/DetailsSection/SchemaForm/index.js | Apply timezone correction when computing initial data for existing events. |
| src/ReportManager/DetailsSection/SchemaForm/index.test.js | Add a test verifying initial onFormDataChange behavior for existing events needing timezone correction. |
Comment on lines
+409
to
+413
| renderSchemaForm({ formData }); | ||
|
|
||
| expect(onFormDataChange).toHaveBeenCalledTimes(1); | ||
| expect(onFormDataChange).toHaveBeenCalledWith(getFormDataWithFixedTimezones(formData, formElements)); | ||
| }); |
Comment on lines
+398
to
+401
| schema.ui.sections['section-3'].leftColumn = [ | ||
| ...schema.ui.sections['section-3'].leftColumn, | ||
| { name: 'date_time_field', type: 'field' }, | ||
| ]; |
Comment on lines
+10
to
+18
| // Utilities to calculate the fixed times in the current timezone. | ||
| const expectedFormattedDateTime = (dateTime) => | ||
| format(parseISO(dateTime), 'yyyy-MM-dd\'T\'HH:mm:ssXXX'); | ||
| const expectedFormattedTime = (time) => | ||
| format( | ||
| parseISO(`${format(new Date(), 'yyyy-MM-dd')}T${time}`), 'HH:mm:ssXXX' | ||
| ); | ||
|
|
||
| describe('ReportManager - DetailsSection - SchemaForm - utils - getFormDataWithFixedTimezones', () => { |
Comment on lines
+8
to
+12
| const correctDateTimeValue = (value, inputType) => { | ||
| switch (inputType) { | ||
| case DATE_TIME_ELEMENT_INPUT_TYPES.DATE_TIME: { | ||
| const parsedDateTimeValue = parseISO(value); | ||
| return isValid(parsedDateTimeValue) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
see title