sc0ttkclark / wordpress-fields-api

The 2024 Fields API proposal for WordPress Core
https://make.wordpress.org/core/tag/fields-api/
361 stars 42 forks source link

Date / Time picker control type #52

Closed sc0ttkclark closed 1 year ago

sc0ttkclark commented 8 years ago

Should we include a date, datetime, and/or time control type?

sc0ttkclark commented 8 years ago

Core includes a jQuery date picker, it handles date + time, but it doesn't have a time-only option. We could use HTML5 time field for that, but I'm not sure if that is enough here or not.

sc0ttkclark commented 8 years ago

Oops, clarification, jQuery UI Datepicker only does dates, it does not include date+time or time.

sc0ttkclark commented 8 years ago

No jQuery UI stylesheet included with WP Core currently -- https://core.trac.wordpress.org/ticket/18909

If we add jQuery UI Datepicker, then nothing will look right, so we have to nixx this (for now).

sc0ttkclark commented 8 years ago

An alternative option: We could reuse the same date and/or time picker that the Post editor screen uses for publish date.

yehudah commented 8 years ago

Maybe I'm not familiar with wordpress standards for 3rd party libraries, but why not using something like this: http://mugifly.github.io/jquery-simple-datetimepicker/

sc0ttkclark commented 8 years ago

Any inclusion of a third party time picker should be done separately from the Fields API, for purposes of evaluating whether or not a specific script is the correct forward-facing choice, is accessible, and meets all criteria for inclusion in core. Only at that point could we move forward with inclusion of one within the Fields API for our purposes. Otherwise, including any script would require time which may not be guaranteed that it would be accepted into core at such a point in time that Fields API is evaluated for merging.

widoz commented 8 years ago

Why don't use the jquery ui datepicker that is available within wordpress? See it in https://developer.wordpress.org/reference/functions/wp_register_script/

However, a date, datetime control will be useful, in case the browsers doesn't support it, the text field will be used right? May be a pattern prefilled?

sc0ttkclark commented 8 years ago

Yes, the jQuery UI datepicker is included with WordPress core, but the styles aren't (yet). If they were, that'd take care of date controls, but would still leave datetime and time controls up in the air since Datepicker only does dates.

kochhase commented 8 years ago

Hi Skott. here this date and time picker is very smart. Matts from facetwp use it. So have a look very fast and very good looking. https://github.com/chmln/flatpickr

widoz commented 8 years ago

There is even the https://github.com/xdan/datetimepicker but flatpickr look very nice.

A fusion of flatpickr and https://github.com/stuttter/wp-datepicker-styling would be great :)

sc0ttkclark commented 8 years ago

Including new Date/time pickers in core as part of the initial Fields API proposal is likely to hold us up in a major way. Our best bet is to move forward with a simple version (jQuery date only) or exclude this type of field entirely.

sc0ttkclark commented 8 years ago

Once Fields API is in core, we can make separate proposals for enhanced control types with scripts like these.