vitmalina / w2ui

UI widgets for modern apps. Data table, forms, toolbars, sidebar, tabs, tooltips, popups. All under 120kb (gzipped).
http://w2ui.com
MIT License
2.65k stars 730 forks source link

Feature Request: Month Picker + Year Picker #1957

Open mpf82 opened 3 years ago

mpf82 commented 3 years ago

We already have date, time and datetime picker.

A month picker and a year picker would be nice additions.

We're currently using JQuery UI's Date Picker as a month picker, but it just does not feel that well integrated with the rest of the w2ui components:

month_picker

vitmalina commented 3 years ago

In w2ui date picker, if you click on header, it will open this

Screen Shot 2021-02-24 at 8 30 22 AM

May be we just need to add down arrow in the header

mpf82 commented 3 years ago

Yeah, I knew that, but the date picker will not "stop" after selecting the month.

I am suggesting new field types:

.w2field('month', { format: 'm/yy' ...    // => 1/21
.w2field('month', { format: 'yyyy-mm' ... // => 2021-02
.w2field('year',  { format: 'yy' ...      // => 21
.w2field('year',  { format: 'yyyy' ...    // => 2021

analogue to the already existing date, time, and datetime.

For month it's probably be sufficient to use the already existing date picker, bring up the month view as default (as seen in your screenshot) and just make it stop after selecting the month.

vitmalina commented 3 years ago

I did a change when dbl click on a month will select it with current year (same with year). As for m/yy find of formats. Possibly it is a good idea, but still struggling how is it better then 2 drop downs ))

mpf82 commented 3 years ago

One advantage would be to use start+end functionality, just like 2 w2fields of type date.

And one field makes validation and getting/setting of values easier than 2 drop downs.