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

bbrindzabbrindza Posts: 320Questions: 75Answers: 1

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

  • allanallan Posts: 63,872Questions: 1Answers: 10,527 Site admin

    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

  • bbrindzabbrindza Posts: 320Questions: 75Answers: 1

    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 ?

  • allanallan Posts: 63,872Questions: 1Answers: 10,527 Site admin

    Is the date picker a DataTables function?

    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 use field().input() to get the input element and create a jQuery UI date picker on it.

    Allan

  • bbrindzabbrindza Posts: 320Questions: 75Answers: 1

    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.

  • allanallan Posts: 63,872Questions: 1Answers: 10,527 Site admin

    That would be great - thank you!

    Allan

Sign In or Register to comment.