#Based on the language selection in the browser, does the date widget changes the format?

1 messages · Page 1 of 1 (latest)

hybrid plazaBOT
#

Hey There,

We've registered your query, and our team will get back to you soon.

Regards,
Pranav

tough sequoia
#

Hello @lavish berry ,
Welcome to Appsmith Support.

May I ask what browser language selection you're referring to. Can you provide some screenshots?

#

Also, by date format, do you mean something in terms of "MM/YYYY/DD" or you mean the timezone. Can you clarify this for me as well?

lavish berry
#

"MM/YYYY/DD" I was mentioning about this format, i want this to be changed based on the country format if browser language is German in 1 format and United states in another format

hybrid plazaBOT
#

Hello! It does not, but I have the solution here. Enable JS for the Date Format
field of your datepicker and use the following snippet. It will generate a
format string based on the locale of the user idToken if available and will fall
back to the browser's locale. Please try this and let me know if it works for
you.

{{
new Intl.DateTimeFormat(appsmith.user.idToken?.locale ||
navigator.language).formatToParts().map(part => {
switch (part.type) {
case 'month':
return 'MM';
case 'day':
return 'DD';
case 'year':
return 'YYYY';
default:
return part.value;
}
}).join('')
}}