Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 798 forks source link

Form block: potential enhancements to Date Picker field #18863

Open pendantry opened 3 years ago

pendantry commented 3 years ago

The current iteration of the 'Date Picker' input field is wholly inadequate. It needs a lot of love.

What (Required)

  1. Ability to click on the year presented in the date picker, and change that (either through text input or by selection from a list) image (see Why/1 below)

  2. Ability to click on the month presented in the date picker, and change that (either through text input or by selection from a list) image (see Why/1 below)

  3. Addition of input validation to ensure that only correct dates are accepted in the field. (see Why/2 below) Note: a) it will be necessary to ensure that the possibility of confusion between US-style 'month-day-year' and almost-everyone-else-style 'day-month-year' is avoided (ie need to avoid the lunacy of not being able to tell, for instance, if ‘6/7/2020’ is ‘July 6 2020’ or ‘June 7 2020’) b) leap years must be calculated correctly -- formula for calculating leap years: (i) The year is evenly divisible by 4 (ii) If the year can be evenly divided by 100, it is NOT a leap year, unless (iii) The year is also evenly divisible by 400 c) (possibly?) avoid over-complication and bizarre incidents in time by stating somewhere that all dates are in accordance with the Gregorian Calendar, and choosing 1582 (the year in which the Gregorian Calendar was first adopted) as the earliest year?

  4. Removal of redundant text " Add a date picker." in the block description (see Why/3(a) below).

  5. Change the default Field Width to 25% (see Why/3(b) below).

  6. (Maybe) Offer a choice of output date formats compliant with ISO 8601 (see Why/3(c) below).

Why (Required)

Screen clipping of current 'date picker': image

  1. The 'date picker' works well enough to enable selection of a date within the current month, but selecting any date beyond that requires that one navigate laboriously, month-by-month, to the desired date using the 'Previous' and 'Next' chevron icons. Choosing a date of birth that's many years ago, for instance, is totally impractical.
  2. There is currently no input validation. While the default rendering of a date selected with the 'picker' tool is good, there is no validation at all of text input to the field (eg I can enter '1919/1/1900' or 'a garbage date' and it doesn't bat an eyelid) image
  3. The Field Settings need attention. For instance: a) the heading includes the text "Add a date picker.", which is redundant (because the user has already 'added a date picker') image b) the default Field Width is '100%'; this is excessive, 25% should suffice in most, if not all, cases image c) it ought to be possible to specify a choice of date formats (preferably in accordance with ISO 8601; but at a minimum using the 'Complete date' format as specified by the W3C -- YYYY-MM-DD (eg 1997-07-16))
cathymcbride commented 3 years ago

@jeherve is this one of Jetpack's?

jeherve commented 3 years ago

It is, yes. I'll transfer the issue over.

jeherve commented 3 years ago

Related: #11251, #7888