How to access JavaScript Class "Date" in a Stream Filter?

+2 votes

I would like to check if some value can be parsed to a date, which should be easy with JavaScript's function Date.parse() but I get an error saying: TypeError: Date.parse is not a function

Is it possible that Multichain restricts the use of the Date class? I know that Date.now() is restricted but is Date.parse() as well?

asked Apr 30, 2020 by multi

1 Answer

0 votes

Yes, Date.parse() is deliberately disabled because its response can depend on the current time or time zone. This can be different between different nodes and therefore introduce non-determinism into the outcome of running the smart filter. I'm afraid you will need to do some more manual parsing of the string based on your own algorithm. Probably a regular expression can help you.

answered May 1, 2020 by MultiChain
...