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

Problems with Date.parse() function

VictorC
New Contributor

Hi, I have a problem with the Date.parse () function.
I cannot convert a String to date, the format of my string is the following: โ€œdd/MM/yyyyโ€.
It only happens to me with some specific dates (with most data I have no problem).
The problem occurs with the following examples:
Date.parse (โ€œ01/04/1932โ€, โ€œdd/MM/yyyyโ€)
Date.parse (โ€œ05/02/1939โ€, โ€œdd/MM/yyyyโ€)
Date.parse (โ€œ09/12/1940โ€, โ€œdd/MM/yyyyโ€)
Date.parse (โ€œ16/12/1943โ€, โ€œdd/MM/yyyyโ€)
Date.parse (โ€œ12/02/1950โ€, โ€œdd/MM/yyyyโ€)
And I always get a NaN as a result of the function.
Thank you.

10 REPLIES 10

rdill
Employee
Employee

Victor,
I can understand how 16/12/1943 would fail. But I tested 1932, 1940 and 1950 and had no issues
This in the mapper expression
Date.parse (โ€œ09/12/1940โ€,โ€œdd/MM/yyyyโ€)
this is the result
_snaptype_datetime: โ€œ1940-12-09T00:00:00.000 UTCโ€

please try again

Hi @rdill,

I have quite similar problem while using Date.parse() function. (Sound to me that started after the new release)

I have a mapper and an input value that Iโ€™m trying to parse using Date.parse(). On the dynamic preview it is showing the correct output but when on the real output it is writing NaN instead of the date value.
Dynamic preview:
image

JSON output of the same snap (same field):
image

VictorC
New Contributor

Hi.
I just tried again and got the following results.

image (12) image (11) image (10) image (8) image (9)

@VictorC Iโ€™ve tried the same expressions and am not seeing the same thing.
What are the other settings in the Snap?
Is this validating on a Cloudplex or a Groundplex? Which version is the Snaplex on?


Diane Miller
Community Manager