setting datetime default

setting datetime default

javismilesjavismiles Posts: 205Questions: 38Answers: 3

I have a datetime field and I want to set its default value to be the current date and time for when u create a new record,
I try it all but it doesnt work, no errors, it just puts whatever it wants

    if (obj.t=="datetime"){
            fieldobj[index]  = {
            label: obj.d,
            name:  obj.i,
            className: obj.c,   
            type:  "datetime",
            def:  function () { 
                console.log("set def");
                vnew=new Date();
                return vnew;
                //return new Date("2018-02-05 12:08:00"); 
            },
            format:    'YYYY-MM-DD HH:MM:SS',
            fieldInfo: 'Euro style date with 24 hour clock...'  
        };

Answers

  • javismilesjavismiles Posts: 205Questions: 38Answers: 3

    my...
    format: 'YYYY-MM-DD HH:mm:ss',
    its the mm and ss lowercase....

    we can close this, thank u

This discussion has been closed.