Date input in form using minDate does accept minimum date

Hi

I have created a user form that contains a date input field. It should not be possible to select a date in the past so in the Date tab of the date input field element I have enabled the Use Input to add moment.js for minDate and in the Minumum Date I have added moment():

This setting is reflected fine in the date picker where I am not able to select a date in the past (today’s date is 28th June 2022):

I can also select today’s date in the date picker and it is inserted into the date field. But as soon as the focus on the field is lost (e.g. by tabbing out or clicking Submit) the field is emptied. If choosing a future date in the date picker the date remains in the input field.

I have tried enabling/disabling the time input but it makes no difference.

Is this a bug?

Hi @jacchr
If today needs to be included in the minDate - please try using this moment snippet to let users choose any time of today even.

moment().startOf("day")

1 Like

Thanks @paras.gera that sorted it out.

@paras.gera do you know if it is possible to input a DateTime object to the moment.js? Or can you use if-statements?

E.g. the day of today’s date is less than or equal to 10 the minDate should be the 11th of next month. Else the minDate should be the 11th next month + 1 month?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.