irurzo
10/12/2022, 9:29 PMconst formatDates = (params, dateKeys) => {
const fn = 'formatDates';
const localParams = params;
log.audit({ title: 'localparams', details: localParams });
log.audit({ title: 'dateKeys', details: dateKeys });
try {
Object.keys(params).forEach((key) => {
if (dateKeys.includes(key) && params[key]) {
log.audit({ title: 'localParams[key] ', details: `${key} : ${localParams[key]}`});
const f = format.format({ type: format.Type.DATE, value: new Date(localParams[key]) });
log.audit({ title: 'f', details: f });
localParams[key] = f;
}
})
} catch (error) {
log.error({ title: `Error: ${fn}`, details: error });
}
log.audit({ title: 'localParams', details: localParams });
return params;
}
Jan Petri
10/12/2022, 9:40 PMcustpage_filter_start_date
might already be a proper date object but it's printed as a string in the logs. So you might effectively be passing a date object into a date object into the format method. Just a thought. The other consideration might be something around timezones perhaps?battk
10/13/2022, 2:47 AMFri Jun 10 2022 00:00:00 GMT-0500
is passed to the Date constructor, which will construct the Date in Pacific timebattk
10/13/2022, 2:48 AMThu Jun 9 2022 22:00:00 GMT-0700
battk
10/13/2022, 2:48 AMbattk
10/13/2022, 2:48 AM06/09/2022
battk
10/13/2022, 2:54 AMirurzo
10/13/2022, 10:38 AMconst dateFor2 = new Date(params[id]);
`const dateString2 = `${dateFor2.getUTCMonth()+1}/${dateFor2.getUTCDate()}/${dateFor2.getUTCFullYear()}`;`irurzo
10/13/2022, 10:40 AMdateString
to format.format({ type: format.Type.DATE, value: new Date(dateString2) });
battk
10/13/2022, 2:08 PM