Javascript Issue with skuid platform?

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Does anyone know why this function wouldnt be recognized on skuid platform?

dateVar.setTime(dateVar.getTime())

I receive an error

"There was a problem rendering a component of type skootable: dateVar.getTime is not a function"
Photo of David Forder

David Forder

  • 2,144 Points 2k badge 2x thumb

Posted 1 year ago

  • 1
Photo of Josh Merritt

Josh Merritt

  • 918 Points 500 badge 2x thumb
I seemed to be able to make it work. Do you have your snippet? Are you loading
$ = skuid.$;
snippet:


console log:
Photo of David Forder

David Forder

  • 2,144 Points 2k badge 2x thumb
$ = skuid.$;

var model = skuid.$M('Contacts');
var row = model.getFirstRow();
var dateVar = row.LastContact;

dateVar.setTime(dateVar.getTime());

model.updateRow(row,{LastContact : dateVar});
Photo of David Forder

David Forder

  • 2,144 Points 2k badge 2x thumb
Realized that we hadnt converted the milliseconds back to a date .. but still no joy

var params = arguments[0],

$ = skuid.$;

var model = skuid.$M('AllContacts');
var row = model.getFirstRow();
var dateVar = row.LastContact;
var now = dateVar.getTime();

var date = new Date(now);

model.updateRow(row,{LastContact : date});
Photo of David Forder

David Forder

  • 2,144 Points 2k badge 2x thumb
Done .. Thanks for the assist

var params = arguments[0],

$ = skuid.$;

var model = skuid.$M('AllContacts');
var row = model.getFirstRow();
var dateVar = new Date();
var now = dateVar.getTime();

var date = new Date(now);

model.updateRow(row,{LastContact : date});