I try to format a date time value according to device settings.
Whatever I change on the simulator settings or in xCode scheme, I always get US format with date.toLocaleDateString()
So I tried different librairies (moment, react-native-localize, ...) but same, always get US format.
So I tried to set Locale directly with this code :
const date = new Date(Date.UTC(2019, 11, 26, 14, 5, 0))
const options = {
dateStyle: 'medium',
timeStyle: 'short',
}
console.log(date.toLocaleDateString('en-US', options)) // Dec 26, 2019, 3:05 PM
console.log(date.toLocaleDateString('fr-FR', options)) // Dec 26, 2019, 3:05 PM
console.log(new Intl.DateTimeFormat('en-US', options).format(date)) // Dec 26, 2019, 3:05 PM
console.log(new Intl.DateTimeFormat('fr-FR', options).format(date)) // Dec 26, 2019, 3:05 PM
And I still get same results !
What can I do to display my date in other Locale than 'en-US' ?
I don't want to hardcore the format by myself ("DD/MM/YYY HH:mm"), I want to use a Locale I set or better the device's one.
Thanks for advice