Date Input shown as dd/MM/yyyy when I specify MM/dd/yyyy

I want the default value of the date input to be the one already presented in the data. However, I found in some cases, the data displayed is in dd/MM/yyyy format while I already specify it to be MM/dd/yyyy

In the table showing the data I pulled, I specify the same data in the same format (MM/dd/yyyy) and it can be shown correctly in the table.

How should I do to make the default value in the date input to be in the format I specified?


Hello, if I'm interpreting your question correctly, you want the default value to be the one you are getting from the database and make sure you get the right format (MM/dd/YYYY)
In this case you can use moment(), like so:

{{ moment(ExceptionData.selectedRow.fldResponseDateOfAction).format("MM/DD/YYYY") }}


Thanks for your response.

I tried your solution, but the data is not showing correctly as well.

as you can see the data pulling from the same datasouce, it shows correctly on the table, and the Retool recognize that date, but on the date input bar, it shows incorrectly.

More interestingly, this behavior is not consistent, for the below example, it can show correctly and consistent to what's on the table

A temporary solution that works for me: force cast the string to 'date' in SQL when pulling the data

Not sure what's the exact issue for the table to be able to format it correcly but not the date input component.

1 Like

You can also try to specify the input format for the moment, like so:

moment(ExceptionData.selectedRow.fldResponseDateOfAction, "MM/DD/YYYY")

1 Like

yeah, i tried that as well.....the date string from SQL is no different in the format upon checking.

I find a temporal solution to force cast the field to date type in SQL when pulling the data, and it works so far.

Thanks for your response tho :slight_smile:

1 Like

@zelterNN the timestamp stays the same value, but i think the two components (date and table) are formatting them differently — see if you can go into the table columns and change the date format:

yeah, i already set the date format in table and the format in date input all to be 'MM/dd/yyyy' and it just the date input, in some cases, confused the MM and dd components.

I'm guessing it might be something internally determining how to parse the date string from SQL is malfunctioned.

1 Like