Set current date time in client

Hi all,

       I try to set current date when click button by function

       var today = new Date();

       this.set("UsrSentAt", { value: today });

       But system shows error "The entered value does not match the column type" and can't display value on datetime picker. How can I set value for it?

Thanks

Like 0

Like

3 comments

Hello Toan!



Please double check if the "UsrSentAt" attribute has DATE type. 

Also, you should pass the value as it is, not creating the object.

this.set("UsrSentAt",   today );

For example:

I have created attribute 

"Date": {

                dataValueType: Terrasoft.DataValueType.DATE,

                type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN

              }



And I was able to successfully set it :

onEntityInitialized: function(){

                this.callParent(arguments);

                debugger;

                var date  = new Date();

                this.set("Date", date);

            }

Hi Alex,

Thanks for replying, see my screenshoot

Toan Mai,

Anyway, example that I sent above should work. Just pass the raw value in the set function instead of new object. 

this.set("UsrSentAt",   today );

Show all comments