cancel
Showing results for 
Search instead for 
Did you mean: 

mapValues returns null when adding certain condition

tarena
New Contributor III

I'm using the following expression to parse date fields in an object. It works correctly. However, when I replace key.contains('date') with another string to compare, the expression returns null for the object.

$attributes.mapValues((value,key) => key.contains('date') ? Date.parse(value).toLocaleDateTimeString({"timeZone":"US/Pacific", "format":"yyyy-MM-dd HH:mm:ss"}) : value)

The behavior is constant with many, but not all strings. 'Item' works, but 'it' doesn't work. No single letter works except for 'z'.

What is this behavior? How can I filter for other keys?

 

1 REPLY 1

koryknick
Employee
Employee

@tarena - Can you please provide some sample input data where this isn't working for you?  And show the results you are seeing that you believe to be incorrect?