What am I doing wrong? This works on the browser, but not on jArchi. Why?
var mydate= Date('2011-04-11');
console.log(mydate)
returns:
Wed Jan 29 2020 13:50:53 GMT-0500 (EST) <-- current timestamp
Try:
var mydate = new Date('2011-04-11');
console.log(mydate.toString());
See https://www.w3schools.com/jsref/jsref_obj_date.asp
I see now... I was trying to do a simple compare dates and I had a couple of things wrong. For example, these two scripts output the same, but in one I'm guessing today is undefined, yet it prints the current timestamp ( ??? ?). JS is weird.
var today = Date();
console.log(today.toString());
var mydate = new Date('2011-04-11');
console.log(mydate.toString());
console.log(today > mydate);
console.log(today < mydate);
var today = new Date();
console.log(today.toString());
var mydate = new Date('2011-04-11');
console.log(mydate.toString());
console.log(today > mydate);
console.log(today < mydate);