fix: DatePicker issue observed when selecting date for icelandic language. #946
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.
Checklist:
How Has This Been Tested?
version: 2.28.0
date-fns/locale = is
import { formatISO, parse } from 'date-fns';
import { is } from 'date-fns/locale';
const values = [
'12 jan. 2024',
'06 feb. 2024',
'06 mars 2024',
'17 apríl 2024',
'07 maí 2024',
'13 júní 2024',
'18 júlí 2024',
'04 sept. 2024',
'23 okt. 2024',
'15 nóv. 2024',
'04 des. 2024'
];
const formattedDates = values.map((value) => {
try {
const parsedDate = formatISO(
parse(value, 'dd MMMM yyyy', new Date(), { locale: is })
);
return parsedDate;
} catch (error) {
console.info(value, error);
}
});
console.log(formattedDates);
For the above code, we are observing the parsing is not occuring for the month sept. , okt. , nov., des.
We are observing the below error.
Stackblitz link for reference: https://stackblitz.com/edit/date-fns-bug-theqmk?file=package.json,index.ts
We are observing the same issue, even in the current version as well. 4.1.0
We have raised the PR with date-fns team to resolve this issue.
date-fns/date-fns#3934
This is a fix to resolve the date picker flow till our changes are merged.