[Bug 14890] For invalid Date, the terminology here seems to be "undefined" insted of "null" according to WebIDL, and the ECMAScript "null" value should never reach here according to the IDL description of attribute "valueAsDate". For readiblity, I suggest we just s/i

https://www.w3.org/Bugs/Public/show_bug.cgi?id=14890

Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #3 from Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu> 2011-12-15 05:16:36 UTC ---
Apparently my one-liner did't work so let me try again. The main problem is as
follows. What should happen if the following script is run?

var input = document.createElement('input');
input.type = "date";
input.value = "2011-12-15";
input.valueAsDate = new Date("hixie"); // invalid date
alert(input.value);

This doesn't seem to be well-defined as various "algorithm to convert a Date
object to a string" algorithms seem to miss this case (the 'undefined' Date).
For your data, Safari 5.1.1 treats invalid date as if it were null and the
result is the empty string. Others pretty much don't have implementations close
to this nit.

(In reply to comment #2)
> I think the problem here was just that valueAsDate wasn't marked as nullable,
> but I'm not sure.

I am not sure why null is better than an invalid date (new Date(NaN)), which I
originally thought to be a better idea, but I can agree that null is more
testable.

(In reply to comment #1)
> Come again?

I don't understand. Could you elaborate?

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 15 December 2011 05:18:40 UTC