WebPlatformTest / HTML5test

How well does your browser support HTML5?
https://html5test.com
MIT License
995 stars 193 forks source link

Test `<input type=datetime>.valueAsDate` #133

Closed kornelski closed 12 years ago

kornelski commented 12 years ago

input.valueAsDate doesn't seem to be implemented in any browser any more.

I'd expect this to return Date object:

$('<input type=datetime value="2012-04-16">')[0].valueAsDate

but I'm getting null in Opera 11.62, despite passing support for input type=datetime in the test.

NielsLeenheer commented 12 years ago

I'll add an test for valueAsDate in the next release.

NielsLeenheer commented 12 years ago

Added valueAsDate and valueAsNumber as a new test for the next release (currently at alpha.html5test.com). The result in the example you give above is as expected however. "2012-04-16" isn't a valid value for a datetime field. valueAsDate is null for invalid values.

The example below seems to work fine:

e = document.createElement('input');
e.type = 'date';
e.value='2010-10-10';
e.valueAsDate