Eonasdan / tempus-dominus

A powerful Date/time picker widget.
https://getdatepicker.com
MIT License
7.15k stars 4.4k forks source link

Config by attribute is not working: ex. Restrict by dateMin #2881

Closed numediaweb closed 9 months ago

numediaweb commented 10 months ago

Prerequisites

Describe the issue

I have checked the docs but couldn't find any mention of providing "inline" config options via the input element data attributes. I tried every combination to name the attributes but none of them work:

 <input id="datetimepicker1Input" type="text" class="form-control"
        data-td-target="#datetimepicker1" 
        data-td-restrictions-min-date="12/01/2023 00:00 A" 
        data-td-restrictions-mindate= "12/01/2023 00:00 A"
        data-td-restrictions-minDate="12/01/2023 00:00 A" 
>

Am I missing some parts of the docs?

Any help would be appreciated :)

StackBlitz fork

https://stackblitz.com/edit/tempus-dominus-v6-repl-zrh1cx?file=index.html,example.js

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of are you using? You can find this information from the sample StackBlitz.

v6

What your browser's locale? You can find this information from the sample StackBlitz.

en-US

Eonasdan commented 9 months ago

Hi. I'll push out a fix for this soon. You will want to use data-td-restrictions_mindate. JS converts the data- attributes to CamelCase and strips the - marks. Should go out this week

Eonasdan commented 9 months ago

This is fixed in 6.9.4