processwire / processwire-requests

ProcessWire feature requests.
39 stars 0 forks source link

InputfieldDatetime: provide a way of setting jQuery UI datepicker options #523

Closed Toutouwai closed 5 months ago

Toutouwai commented 7 months ago

Short description of the enhancement

InputfieldDatetime can use the jQuery UI datepicker, and sometimes this is forced e.g. in InputfieldSelector. The datepicker options are hardcoded and there doesn't seem to be a way to customise the options for a given datetime inputfield.

This request is for a feature where the datepicker options can be set for an InputfieldDatetime instance.

Something like:

$inputfield = $this->wire()->modules->get('InputfieldDatetime');
$inputfield->datepickerOptions = [
    'minDate' => 'new Date(2007, 1 - 1, 1)',
    'constrainInput ' => false
];

And maybe there could be config field for this when InputfieldDatetime is used together with a PW field?

MetaTunes commented 7 months ago

This would be very useful as currently it seems like there is no easy way of doing a relative date comparison in InputfieldSelector. But also need to consider how InputfieldDatetime is stored - see discussion