Fix date format interpretation for dd/mm/yy format #7616
Closed
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.
Fix date format interpretation for dd/mm/yy format
Issue
When using the
dd/mm/yy
date format, the component was incorrectly interpreting date strings. Specifically, when a date string like09/10/2025
(representing 9th October 2025) was passed to theformatValue()
function, it would incorrectly return10/09/2025
(10th September 2025).This issue only occurred:
dd/mm/yy
date formatRoot Cause
JavaScript's default date parsing interpreted the date string using the American format (mm/dd/yyyy) regardless of the format specified in
dateFormat
. This caused ambiguous dates where the day is ≤12 to be interpreted incorrectly.Solution
Added specific handling for the
dd/mm/yy
format to correctly parse date strings using the European format (day first, then month). The solution:dd/mm/yy
Before the fix, some date strings were misinterpreted due to incorrect handling of date formats. Specifically, dates in
DD/MM/YYYY
format were being mistakenly parsed asMM/DD/YYYY
.Example
Before the fix:
"09/10/2025"
"10/09/2025"
After the fix:
"09/10/2025"
"09/10/2025"
Test Cases
Summary
The fix ensures that date strings are correctly interpreted according to the
DD/MM/YYYY
format. This prevents confusion and potential data errors for users.