Skip to content

resolving conflicts, merging down lost hotfix 2.134 --> develop#1568

Open
JoshuaVulcan wants to merge 1 commit into
developfrom
back-merge/release-2.134.1
Open

resolving conflicts, merging down lost hotfix 2.134 --> develop#1568
JoshuaVulcan wants to merge 1 commit into
developfrom
back-merge/release-2.134.1

Conversation

@JoshuaVulcan
Copy link
Copy Markdown
Collaborator

What does this PR do?

see title

Copy link
Copy Markdown
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 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 getFormDataWithFixedTimezones utility to recursively timezone-normalize DATE_TIME/TIME fields (including inside collections).
  • Update SchemaForm initialization 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants