Entering dates in date component

When I enter dates in the date component - is there a way to change to UK style from US style?

e.g. when I type 2/3/22 the component goes to 3rd Feb 2022 (when I want 2nd Mar 2022)

My query saves correctly when I have the correct date showing the component and I use moment to make sure the formatting agrees with Azure.

The component displays the format correctly as per the properties of the component: E d MMM yy -> Thu 2nd Mar 22.

But I just can't type it in the format that I want? There seems to be no property for this in the component? or have I missed something?



1 Like

Hey @jclutterbuck the easiest way to get this working would be to first change how the value of the column is formatted using MomentJS, which is a built-in library for Retool.

You can format your date by doing something like this:

using the .format method you can change the format of any date easily, you can read more about this here in the MomentJS docs.

After you have formatted the value of the date populating each row, then you can fill out the Format section of the column with the correct representation of the date you would like using this table here as a guide.

In your case you wanted it to display Day, Month, and Year so one way to show that is d MMM, yyyy. After doing that you should see the date displayed correctly, like so:

Hope this helps!

You can also use toLocaleString. W3 Schools has some good documentation here.

Thanks @cperea and @stevenhdsdoor

However, I am familiar with the moment library and I LOVE the W3 resources!

But this is not about displaying the date by formatting it (as I understand it).

It's about how the date is interpreted when entered in the box.

The two date components are now, at least, consistent but the both interpret dates in US format "m/d/y" and I would prefer UK format "d/m/y" but I cannot see an option or property to select this?

In the image above, I have typed 3/4/22 and wanted the 3rd April 2022 but the calendar, automatically displayed by the date component (very helpfully), is suggesting 4th March 2022.

Any ideas?



1 Like

Very interesting issue. I would message retool support and ask. I wasn't understanding your issue until I recreated it. Will all your users be inputting in that format? You could write some javascript to flip the day month on input. The only issue is if anyone else puts in the date in the US format it will also flip it and you are back at step one.

The same problem causes me to constantly write down invoice numbers incorrectly. I hope a solution is found.