- Issue created by @MacSim
- π«π·France MacSim
I just realised the module uses jQuery UI datepicker which doesn't support time.
It's not as easy as I first wrote in the issue
We would need another lib to achieve this and it might be the occasion to search a Vanilla JS alternative to this jQuery UI datepicker. - πΊπΈUnited States smustgrave
Version 6.0.x using jquery ui
Version 7.0.x uses ui slider
- π«π·France MacSim
DatePickers are still implementing a jQuery UI component on 7.0.x:
DatePickers.php on 7.0.x$form['#attached']['library'][] = 'better_exposed_filters/datepickers';
better_exposed_filters.libraries.yml on 7.0.x
datepickers: js: js/bef_datepickers.js: {} dependencies: - core/drupal - core/drupalSettings - core/jquery
Maybe we should leave the DatePickers filter plugin as it is and start a new DateTimePickers filter plugin.
That way we wouldn't break anything on websites implementing DatePickers, we would just bring a new feature in.
I didn't found a lot of datetime pickers JS lib yet ; flatpickr might be an option. - ππΊHungary nagy.balint
I recently added a bef submodule to Datetime Flatpickr β , it does not yet support time entry, but might be extendable, as an alternative.
- πΊπΈUnited States smustgrave
Yes the JS behind still uses jquery but the datapicker itself is ui_slider. https://www.drupal.org/project/jquery_ui_datepicker β was removed
- π«π·France MacSim
@smustgrave I don't know anything about ui_slider lib, but the
$('.bef-datepicker').datepicker(opt);
really looks like a jQuery UI datepicker instantiation.
Anyway, if you're sure it is a slider_ui implementation, do you think it would be possible to bring a DateTimePicker with that slider_ui in BEF?
If yes I'll leave the current issue opened, else I guess we can close it and I'll go for the alternative option purposed in #6. - πΊπΈUnited States smustgrave
I apologize idk why I kept bringing up slider when you were clearly talking dates.
Yes that's uses core jquery datepicker and not the contrib module.
But if #6 works for you we can update the docs to recommend it and close this?
- π«π·France MacSim
Actually Flatpickr does work but accessibility is not good.
IMHO the best option would be to make a BEF plugin based on an<input type="datetime-local" />
- Merge request !150Issue #3500976 by macsim: Make the DatePickers plugin also handle time β (Open) created by MacSim
- π«π·France MacSim
Implemented a first version of that datetime picker.
Next step would be to give the ability to configure some options like
'#date_date_format'
'#date_time_format'
'#date_year_range'
- π«π·France MacSim
The input is correctly displayed as a datetime-local input but using the filter returns no element.
- ππΊHungary nagy.balint
I think that last time I tried, my issue was that there was no way to define the date format of the input when using these new input types.
That is why I am using flatpickr.
- π«π·France MacSim
#15 Did you try to use
#date_date_format
and#date_time_format
? - π«π·France MacSim
With the patch provided on the related core issue ( https://www.drupal.org/project/drupal/issues/3505318 π¬ Support to use the datetime-local element Active ) the BEF "Datetime picker" plugin is now working for me but I agree with #15: I didn't found a way to define the date format of the input.
- π«π·France MacSim
Same problem than Datepicker plugin:
"Datepicker doesn't register relative dates" ( https://www.drupal.org/project/better_exposed_filters/issues/3470801 π Datepicker doesn't register relative dates Active )