Forum Moderators: phranque
The dates come in as a variable in the format 2003-01-28
I use a split function to replace the hyphens with commas as follows:
//CODE------------------------------------------------------------------
var arrive = arrivaldate;
var ariveArray = arrive.split('-');
var arrive = (ariveArray[0] + ',' + ariveArray[1] + ',' + ariveArray[2]);
//---------------------------------------------------------------------------
I then use them in a date function as follows:
var earlierdate = new Date(arrive);
However this causes an error (eg earlierdate = "nAn").
If I feed the date in manually it works fine eg:
var earlierdate = new Date(2003,01,28);
But using the variable does not work.
Why O Why?