Open alexfauquette opened 10 months ago
Hi, we have a bug on @mui/x-pickers when using the expandFormat with Brazilian locale https://github.com/mui/mui-x/issues/10177
expandFormat
Basically, formatting a date with the extension of the token DD is buggy. since it contains de word, which is not escaped, leading to the d being transformed in the day number.
DD
de
d
Codesandbox reproduction:
const date = DateTime.fromISO("2014-08-06T13:00:00.000Z"); const format = DateTime.expandFormat("DD", { locale: "pt-BR" }); // d de MMM de yyyyy // Broken formating const withExpandFormat = date.toFormat(format, { locale: "pt-BR" }); // Working formating const withoutExpandFormat = date.toFormat("DD", { locale: "pt-BR" });
withExpandFormat ("d de MMM de yyyyy"): 6 6e ago. 6e yyyyy withoutExpandFormat ("DD"): 6 de ago. de 2014
I would expect date.toFormat(format, { locale: "pt-BR" }); to escape non token string as follow
date.toFormat(format, { locale: "pt-BR" });
- d de MMM de yyyyy + d 'de' MMM 'de' yyyyy
Hi, we have a bug on @mui/x-pickers when using the
expandFormat
with Brazilian locale https://github.com/mui/mui-x/issues/10177Basically, formatting a date with the extension of the token
DD
is buggy. since it containsde
word, which is not escaped, leading to thed
being transformed in the day number.To Reproduce
Codesandbox reproduction:
withExpandFormat ("d de MMM de yyyyy"): 6 6e ago. 6e yyyyy withoutExpandFormat ("DD"): 6 de ago. de 2014
Actual vs Expected behavior
I would expect
date.toFormat(format, { locale: "pt-BR" });
to escape non token string as followConfig