What is needed for a valid Javascript Date object?

zidane1986

New Member
I've been banging my head over this one all day. No matter how I initialize a Javascript Date I cannot seem to get a valid Date object... I'm assuming the Date is invalid and not working properly by inspecting it with Chrome's debugger, which has the value '__proto__: Invalid Date'.I've tried all of the following:\[code\]var d = new Date();var d = new Date('2012-10-08');var d = new Date('2012-10-08 00:00:00');var d = new Date(Date('2012-10-08'));var d = new Date(Date.parse('2012-10-08'));var d = new Date(2012,10,08);var d = new Date("October 13, 1975 11:13:00");\[/code\]Along with countless other attempts.This is presenting a problem in iOS where I'm trying to get values from these Date objects but every function just returns NaN. I'd prefer to avoid having to use external libraries or have to convert YYYY-MM-DD format into any other format since I'm trying to get this to work with an HTML5 input type="date" with minimal code for a mobile site.Essentially this boils down to: What are the parameters that make a Date object valid?!
 
Back
Top