(ADO-3242) Date format YYYY-MM-DD into MM/DD/YYYY for save ICM data#90
Merged
Conversation
…ired format for XML conversion
bzimonjaSDPR
approved these changes
Aug 25, 2025
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.
Commit: create a date converter and change date format to ICM required format for XML conversion
What changes did you make?
Added a file called dateConverter.js that contains a function which converts a string in date format YYYY-MM-DD to a string in date format MM/DD/YYYY.
Updated saveICMdataHandler.js to find all the fields using type: date, and then updated the date format to the above ICM required MM/DD/YYYY with the function.
Why did you make these changes?
As per https://dev.azure.com/BC-SDPR/Forms%20Modernization/_workitems/edit/3232, ICM requires date fields have their format be MM/DD/YYYY. The form data uses YYYY-MM-DD, which is currently not acceptable for ICM. Updating the dates to use MM/DD/YYYY when translated to XML version should fix this.
Child date field ids do not include their parent UUIDs while comparing the found field type, which is why there's a substring check:
dateItemsId.includes(oldChildKey.substring(stringLength+3, childStringLength))What alternatives did you consider?
I considered using a pattern match to update date fields to new format, however that ran the risk up updating non-date field types. By finding the date field ids first and then applying format changes during the UUID change, this meant there was no additional looping happening to overwrite the fields and no problem matching UUIDs with the date field ids found.
There is an error handling for the function when a date input does not met requirements (i.e. cannot be separated into Year, Month, Day for re-formatting). This sets the return values as -1 because there is a chance of date fields being null within the json/form.
Checklist