on 06-04-2019 8:31 AM
Hi all,
I am processing some dates within a script; however the "new Date()" command does not work anymore... it outputs "Invalid Date" when it's called with a date in ISO format, e.g.
var hiredate = Par.get("HIREDATE"); <<< it's 01.06.2019
var hiredateISO = new Date(custom_convertDate(hiredate)); <<< custom_convertDate returns 2019-06-01
hiredateISO is "Invalid Date".. why??
I cross tested the script snippets at w3schools and it was running as expected.. any hint?
Regards, Richard
Hi Richard,
Testing code snippets in a modern JS interpreter, while useful to an extent, can also lead you astray in some cases.
I've not determined exactly which JS engine is used by IDM, but if I am not mistaken it appears to be a very old version of Mozilla's code. This is inferred from the lack of certain functions and methods which more modern engines have implemented. The oldest example I've come across is the indexOf() array method, which has been implemented in browsers since around 2005, but is still not available in IDM. Unless it was purposefully removed, this would suggest the engine is at least this old.
Therefore, I would guess that support for ISO 8601 date strings as inputs to new Date() was a more recent addition to Javascript - I can't find specific details from a quick search, but hopefully this gives you a starting point to look into, if you are so inclined.
Kind regards,
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.