Jeff Jacobs
08/22/2024, 5:56 PMvar formattedDate = format.format({
value: previousSunday,
type: format.Type.DATE
});
customRecord.setValue({
fieldId: 'custrecord_nr_ttl_week',
value: previousSunday
});
and
var formattedDate = (previousSunday.getMonth() + 1) + '/' + previousSunday.getDate() + '/' + previousSunday.getFullYear();
ASH
08/22/2024, 6:12 PMJeff Jacobs
08/22/2024, 6:13 PMJeff Jacobs
08/22/2024, 6:18 PMJeff Jacobs
08/22/2024, 6:19 PM// Manually format the date as M/D/YYYY
var formattedDate = (previousSunday.getMonth() + 1) + '/' + previousSunday.getDate() + '/' + previousSunday.getFullYear();
// Convert the formatted date string back to a Date object
formattedDate = new Date(formattedDate);
Jeff Jacobs
08/22/2024, 6:22 PMASH
08/22/2024, 6:22 PMJeff Jacobs
08/22/2024, 6:23 PM// Get the previous Sunday date
var today = new Date();
var dayOfWeek = today.getDay();
var previousSunday = new Date(today.setDate(today.getDate() - dayOfWeek));
// Strip time from the date
previousSunday.setHours(0, 0, 0, 0);
Jeff Jacobs
08/22/2024, 6:24 PMASH
08/22/2024, 6:24 PMJeff Jacobs
08/22/2024, 6:24 PMJeff Jacobs
08/22/2024, 6:45 PMJeff Jacobs
08/22/2024, 7:29 PM