I have a date-input on my view, bound directly to a field:
When I select the date, it displays correctly . On save of the object, I apply a format on the date for display in another field, without modifying it’s value. The code to format is:
function sharedFormatDate(date) {
var d = new Date(date),
month = ‘’ + (d.getMonth() + 1).toString().padStart(2, “0”),
day = ‘’ + d.getDate().toString().padStart(2, “0”),
year = d.getFullYear();
return [year, month, day].join('-');
}
When I go to view the object just created, the day portion is always 1 less than what I selected . What am I doing wrong?