Moment datepicker different dateformat based devices

Hi,

I’m using this: GitHub - livechat/moments-apps-examples

I have seen different date format beeing returned simply based on the device used by the visitor.
How can I force a specific date format to always be returned? Eg: MM/DD/YYYY in the chat

Thank you, Thibault

Hello @Thibault ! :wave:

Sorry for the late reply, just got an answer from our tech team:

The example on purpose uses toLocaleDateString() which presents the date according to user agent’s timezone.
You can use with specific parameter (e.g. toLocaleDateString(‘en-US’) will return the date in format 21/04/2022), use toDateString() instead for the output “Thu Apr 21 2022” or create a function with the method Intl.DateTimeFormat for your own custom formatting.

Let me know if that helps!

Hi,

Thanks for helping. I want to use the: toLocaleDateString(‘en-US’) solution.

How can I replace en-US with data from an URL?
For example ?lang=en-US

Thank you