Set Current Date in Date Field

Hi All,

I need to set the current date to a Date Field control to filter a list based on date selection. On page load, the list should be filtered according to the current date.

I tried the Javascript component to get the current date and set it to the date field but it does not work. Please help me set the current date in the date field.


You can try this formula :


Use the format you want.

1 Like

I tried this but it has a validation error. “The binding requires an inversible formula”.
I used this formula in the ‘Selected value’ property.

1 Like

Date field 1 must be Text / Number format, not Date/Time Text

How can I change the Date Field format?

Which component do you use?

I am using Date Field.

I also created an app variable and used Now() to set a value in this variable. If I alert the date using the same app variable, it displays correct date but I need to set the current date in the date field once the page is loaded.
I am navigating to a new page with a date field and it should have current date set when the page gets loaded.

Okay, I understand better. In which field are you trying to put the formula? Minimum date, …

I am putting the formula in the Selected Value field.

Why put a component to choose the date, if you decide the value and not the user?

We want to set the current date as the default value once the component is loaded.

Put the formula in minimum date, in this case.

I used the PickDate flow function from the market and for the “From date” set Min date to 01 and Max date to 31 with Initial date as formula as DATETIME(0) and assigned the value to a page variable
Then for the “To date” same Min and Max but Initial date used the page variable above.
Working a treat !

@Bertrand_BZH How would you set a default date of today BUT also allow the user to select dates prior to today? (Minimum date would prevent that.)

You’re right. In this case this cannot work .


You just copy the formula “FORMAT_DATETIME_LOCAL(NOW(), “DD-MM-YYYY”)” to “Placeholder text” field and you will get the default initial value.

I want the current date to be selected when the page is loaded so that I can pass the current date in the rest service. All the formulas work as a placeholder text but I need the current date to be selected in the date field once the page is loaded.

In that case:

  1. You should use an appVariable to set value to FORMAT_DATETIME_LOCAL(NOW(), “DD-MM-YYYY”) and after you can trigger your API Rest with this value. All this logic should be written in Page mounted Event.

  2. In parallel, the FORMAT_DATETIME_LOCAL(NOW(), “DD-MM-YYYY”) value must be assigned to Date Field control “Placeholder text” property to initialize this control to now() date. You should test with the appVariable.

  3. You should view the “Output value 'Selected value’s label changed” Event. Maybe is useful too.

Every kind of date format works with the placeholder of date picker but how can we set the date in the date picker on page load. After the date is displayed, only then the service needs to be called.
The solution that you proposed will work but the requirement is to set the date on the page load and once it is set, the rest service needs to be called on a button click. I tried different solutions but those do not work.