Date.now() = CDate(...).now is not a function!

If I use Date.now() in my app and run it in the local chrome browser is get “Uncaught TypeError: CDate(…).now is not a function”

But if I use Date.now() in the browser console it works.

If I use,

console.log( Date.now() );

it works.

But if I use it in a function I get the error, “Uncaught TypeError: CDate(…).now is not a function

function checkTime() {
  if (Date.now() > 136565656) {
    //do something  
  }
}

When I checked the code in the browser my code Date.now() has been replaced with CDate(new Date())

I have found that CDate is a VBScript, so I’ve wrapped my function code inside JavaScript End JavaScript and now it works.

I’ll leave this here incase it helps anyone else.

Chrome noted the data type mismatch and tried, incorrectly, to fix your code, of course without warning. I believe you either need to change date.now to long integer or the contant integer to a date.