javascript to add days to a date

  • 1
  • Problem
  • Updated 2 years ago
I found a couple of posts on here detailing some javascript to calculate a date by adding days to a starting date and thought I had the javascript down pat but cant get it to work at all.

I am using Skuid Platform

We have a field called "MostRecentContact", another number field for the days interval, "ScheduledContactFrequency"and want the result in a date field "NextDue" - none of the fields are UI fields and none are read only.

The javascript is below.. does anything dramatically wrong jump out at anyone )

var field = arguments[0],
$ = skuid.$,
value = arguments[1],
SourceDate = new Date(field.row.MostRecentContact.substr(0, field.row.MostRecentContact.lastIndexOf('.'))),
DaysToAdd = skuid.$M('Account').getFirstRow().ScheduledContactFrequency,
NextDue = SourceDate + DaysToAdd;
field.element.append(NextDue)

Any help would be greatly appreciated )
Photo of David Forder

David Forder

  • 2,084 Points 2k badge 2x thumb
  • confused

Posted 2 years ago

  • 1
Photo of David Forder

David Forder

  • 2,084 Points 2k badge 2x thumb
any help would be hugely appreciated )