Forum Discussion
Hi tarena ,
This might because Date.parse returns a not-date causing for it to set as null
Now if you can check first the output from the Date.parse before setting up the value
$attributes.mapValues((value,key) => key.contains('date') ? (Date.parse(value) instanceof Date ? Date.parse(value).toLocaleDateTimeString({"timeZone":"US/Pacific", "format":"yyyy-MM-dd HH:mm:ss"}) : value) : (value) )
Thank you. This was pretty close to the problem. If there is an error in a function called in mapValues, a null object is returned as the result of map values. My original error was from adding an or condition that would include keys which couldn't be parsed as dates. This error turned the entire object to null, which was what I observed.