toLocaleDateString on Android returns wrong format

Viewed 29

I use toLocaleDateString to get different date formats for different countries. But on Android then I pass, for example, 'fr-FR' or 'en-GB', it returns 'mm-dd-yyy' format instead of 'dd-mm-yyyy'. On iOS and desktop it works correct.

Here is my code:

const options = {
  year: 'numeric',
  month: '2-digit',
  day: '2-digit',
  timeZone: 'UTC',
  timeZoneName: 'short'
};

const localeDate = new Date("2022-09-23").toLocaleDateString('fr-FR', options);
console.log(localeDate)

0 Answers
Related