cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Date.parse() & Daylight Saving Time

snapg
New Contributor

Likely a basic javascript question but trying to understand how to handle in a single mapper. I receive a date from a vendor file in UTC time but not UTC format. Expression below works fine except during daylight saving time where you will receive NaN when you attempt to parse between 2am-3am. Is there a simple trick to handle this or do I have to somehow shred the date first to put it in the correct format? Can that be done in a single mapper?

Example:
Fails
Date.parse("3/10/2024 02:53","MM/dd/yyyy hh:mm").toLocaleDateTimeString({"timeZone":"US/Pacific", "format":"yyyy-MM-dd'T'HH:mm:ss"})
Succeeds
Date.parse("3/10/2024 03:53","MM/dd/yyyy hh:mm").toLocaleDateTimeString({"timeZone":"US/Pacific", "format":"yyyy-MM-dd'T'HH:mm:ss"})

Thank you for any assistance!

0 REPLIES 0