Need to have inline date picker to show only Year and Month selection , not days
Need to have inline date picker to show only Year and Month selection , not days
Using DataTables Editor v2.3.2 I need the date picker to popup only to show the year and month. Here is the field I need to do this on.
fields: [
{
label: "Incentive Unit Date",
name: "EIPDTE",
type: 'datetime',
format: 'YYYY-MM',
}
],
columns:[
{ data: "EIPDTE",
render: function(data, type, row) {
if (data && data.length === 6) {
return data.substring(0, 4) + '-' + data.substring(4, 6);
}
return data; // Return original data if it's not in the expected format
}
},
],
Answers
I'm afraid that is not something that the date picker can currently do - sorry! It has a parts breakdown to show / hide components of a date time value, but it doesn't break it down to year, month, day resolution.
Could you use a text field and put a validator on it?
Allan
That is what I did initially. Is the date picker a DataTables function? I use jQuery date picker in other application where I can format the pop-up calendar as dateFormat: 'MM yy',. I there a way I can uses jQuery date picker in an Editor inline input ?
Yes, it uses my DateTime picker library.
There is no reason you couldn't use jQuery UI as a date picker though. Create a regular
type: 'text'
field and then usefield().input()
to get theinput
element and create a jQuery UI date picker on it.Allan
Sounds like I plan. Give me a couple of days to work that out and I will gladly post the solution for the rest of the community. Thanks for the tip.
That would be great - thank you!
Allan