Dynamic Date Picker Minimum Date

I have a date picker field that the user is to enter a birthdate. What I need to do is make it so the birthdate entered must be at least 15 years old. I can enter a static min date but then I would have to update it every day. Not practical.

Any ideas on how to make a date picker minimum date dynamic either through the date picker controls or validation?

<input type="text" class="form-control form-control-sm" id="inputBirthDate" name="inputBirthDate" aria-describedby="input4_help" is="dmx-date-picker" format="YYYY-MM-DD" showdropdowns="true" required="" dmx-bind:value="clientDetails.data.query.client_dob">
2 Likes

Maybe use the dynamic minimum date?
I have a current user-date in a variable var_clientdatetime :

<input class="form-control bg-white p-1 shadow-sm" id="dateStart1" name="dateStart1" is="dmx-date-picker" autoapply="true" format="DD-MM-YYYY" style="width: initial;" size="8" dmx-bind:mindate="var_clientdatetime.value.addYears(-15)">
1 Like

Thanks Teodor, I looked everywhere except dynamic Attributes. :beers:

1 Like

If you can enter it static, then it’s most probably available dynamic in the dynamic attributes :stuck_out_tongue:

1 Like

Ok, this works perfectly. Except for one thing.

The year dropdown starts on the earliest year which I have set to 80 years. Most clients will be around 30 years old. So every entry requires a lot of scrolling.

So is there a way to set a default year or even have the dropdown default to the latest year?