Page MenuHomePhabricator

Support `type=week` in TextInputWidget and DateInputWidget
Open, LowestPublic

Description

With https://gerrit.wikimedia.org/r/#/c/317005/ we're supporting type=month in TextInputWidget, but not type=week.
For consistency let's add type=week as week and year input type as well…

DateInputWidget could support a "week" precision to provide a prettier, consistent, and more widely-available week picker that infuses over a type=week TextInputWidget.

Event Timeline

Volker_E renamed this task from Support `type=year`, `type=week` and `type=day` as types on TextInputWidget as well to Support `type=year` and `type=week` as types on TextInputWidget as well.Oct 22 2016, 9:27 PM
Volker_E updated the task description. (Show Details)
Volker_E updated the task description. (Show Details)
Volker_E renamed this task from Support `type=year` and `type=week` as types on TextInputWidget as well to Support `type=week` as types on TextInputWidget as well.Oct 22 2016, 9:40 PM
Volker_E renamed this task from Support `type=week` as types on TextInputWidget as well to Support `type=week` as type on TextInputWidget as well.
Volker_E updated the task description. (Show Details)

For reference, what Chrome/Blink's week picker looks like:

pasted_file (224×326 px, 15 KB)

A feature for DateInputWidget?

I was remembering that it was told to me before by other OOjs UI developers, that other type attributes are just added on clear use cases as several input types new to HTML5 have not been seen wide adoption.
From a code perspective it seems inconsistent, but given the arguments above, I'd rather close it as invalid now.
Please pick it up if you see a strong need.

Oh, I wasn't arguing against the task. Since I got date and month types added to TextInputWidget so that I could use them as the non-JS versions of DateInputWidgets, I was stating that if the week type was added, the corresponding week selection feature should be added to DateInputWidget to provide a nicer, more widely-available week selector.

Sn1per renamed this task from Support `type=week` as type on TextInputWidget as well to Support `type=week` in TextInputWidget and DateInputWidget.Oct 22 2016, 10:42 PM
Sn1per reopened this task as Open.
Sn1per triaged this task as Lowest priority.
Sn1per updated the task description. (Show Details)

When writing (my version of) DateInputWidget, I didn't add 'week' precision because the implementation was daunting. The way you calculate weeks depends on the language and the country in very annoying ways (weeks can start on Saturday, Sunday or Monday; and weeks that straddle year boundary are sometimes counted as part of the previous, and sometimes next year). And I couldn't think of a use case.

For TextInputWidget, I'm not really sure if we should be allowing any types that are not pure text… DateInputWidget could override getInputElement() to use the different types. But we've allowed 'day' before, so I merged the patch for 'month' as well, and thought we might reconsider that in a couple months/years… but if you want to do it now… ;)

But we've allowed 'day' before

Guess you meant 'date'