Default date without the current time

  • Goal: Using the date component and for default value I have {{ new Date() }}. The value I get is "2024-06-12T03:08:24.960Z" → "2024-06-11T22:08:24.960-0500".

What I want is for the default value to be "2024-06-12T00:00:00.000Z" → "2024-06-11T00:00:0.000-0000"

How do I do it? Im sure it's super easy, thanks in advance.

1 Like

Hi there @Firas_Alashram,

Try the following:

{{ new Date(new Date().setUTCHours(0, 0, 0, 0)).toISOString().replace('Z', '-0000') }}
1 Like

@Firas_Alashram

moment(new Date()).format("DD/MM/YYYY")

Since Retool offers moment.js, you can utilize it.

2 Likes

I Get this error when I try to use your solution @suranisaunak. If you can let me know what I'm doing wrong.

Thanks

Screenshot 2024-06-12 at 8.58.07 AM

You have to put them between curly brackets :wink:

THANKS!!! It worked :slight_smile:

1 Like