DatePicker with days of month disabled

I need to build a form for the user to fill in. We only need to collect the input of the year and month from the DatePicker the user selects. How do I make it up in scripts? :sweat_smile:

Bear in mind that that months in Javascript are zero-based, meaning January is 0, February is 1, and so on. Change the field, datepicker, and dataset names to fit your situation. This is based on a collection with field names (keys) of number type entitled “month” and “year”.

 let theDate = $w("#datePicker1").value;
 let month = theDate.getMonth();
 let year = theDate.getFullYear();
 let item = $w("#dataset1").getCurrentItem();
 item.month = month;
 item.year = year;
 $w("#dataset1").setFieldValues(item)
 $w("#dataset1").save();

I’m sorry that I mislead the wrong direction. I wanted to make an element to accept input of year and month. If DatePicker can be scripted to make its days of month disappear, it’s great.

You can disable all of the dates, but then that would give the user nothing to select. The datepicker functionality is tied to the actual selecting of dates.

Another option would be to create a custom dropdown that has months and years listed as choices. That would take some Javascript to have it always be loaded with the coming months.

Thank you. That means I cannot take advantage of DatePicker.