AnsweredAssumed Answered

How do I programmatically set a datetimecombo field?

Question asked by karmet on Feb 9, 2016
Latest reply on Feb 9, 2016 by karmet

I have tried these examples in record.js:


this.model.set('my_custom_datetime_field_c', "2016-02-01 00:00:01");
this.model.set('my_custom_datetime_field_c', Date.parse("2016-02-01 00:00:01"));


The first one gave this error on save:


Did not recognize my_custom_datetime_field_c as a date\/time, it looked like 2016-02-01 00:00:01


And the second one caused an error upon save:


Uncaught TypeError: value.replace is not a function

And the error is triggered inside validation.js:225

if(_.isNaN(Date.parse(value)) && _.isNaN(Date.parse(value.replace(/[\.\-]/g, '/')))) {


My last hope is converting the datetime field to a text-field, but that is bad in many ways.