Locale date is turning to US on mobile but not on browser

Hello ReTool community !

I have this following query transformer that parse the date and format it to french.
It works like a charm on browser but when I go on mobile the date turn to US locale (see example after).

const dateFormat = new Intl.DateTimeFormat("fr-FR", {
  timeZone: "Europe/Paris",
  weekday: "long",
  day: "numeric",
  month: "long",
});

const timeFormat = new Intl.DateTimeFormat("fr-FR", {
  timeZone: "Europe/Paris",
  hour: "2-digit",
  minute: "2-digit",
});
data.date = data.start_date.map((start_date) => {
  const startDate = new Date(start_date);
  return dateFormat.format(startDate);;
})
data.time_range = data.start_date.map((start_date, index) => {
  const startDate = new Date(start_date);
  const endDate = new Date(data.end_date[index]);
  const time = timeFormat.format(startDate) + " - " + timeFormat.format(endDate)
  return time;
})
return data;

Result on browser :

Result on mobile :
|

I wonder if someone had the same issue and how could I improve my code to make it works on mobile too ?

Thank you for your help
Have fun
Emilien

Hey @emilienbidet! Happy to help you with this.

Do other mobile phones show the same US locale (curious if maybe you have a certain setting on your phone)?

What component are you using to display the time? I'd like to try reproducing this issue on my end :slight_smile:

Hey @victoria !

Thank you for you answer. Yes I just tried with 2 friends phone and it's the same.
I use the text component to display the time. See below :

Thank you very much
Emilien

Hey @emilienbidet! I think this may be a bug with our Mobile product that I'll go ahead and file now. In the meantime, could you use moment (a library built into Retool, docs here) to format your date as a string (e.g. moment().format(...) ) to make sure it's properly displayed every time?

1 Like

Thank you very much @victoria !