<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>14890</bug_id>
          
          <creation_ts>2011-11-20 21:14:02 +0000</creation_ts>
          <short_desc>For invalid Date, the terminology here seems to be &quot;undefined&quot; insted of &quot;null&quot; according to WebIDL, and the ECMAScript &quot;null&quot; value should never reach here according to the IDL description of attribute &quot;valueAsDate&quot;. For readiblity, I suggest we just s/i</short_desc>
          <delta_ts>2012-07-18 18:47:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#dom-input-valueasdate</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>kennyluck</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>60261</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-11-20 21:14:02 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html
Multipage: http://www.whatwg.org/C#dom-input-valueasdate
Complete: http://www.whatwg.org/c#dom-input-valueasdate

Comment:
For invalid Date, the terminology here seems to be &quot;undefined&quot; insted of
&quot;null&quot; according to WebIDL, and the ECMAScript &quot;null&quot; value should never reach
here according to the IDL description of attribute &quot;valueAsDate&quot;. For
readiblity, I suggest we just s/if the new value is null/if the new value is
the invalid Date/.

Posted from: 114.43.114.197 by kennyluck@csail.mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20100101 Firefox/8.0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61180</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-07 23:42:27 +0000</bug_when>
    <thetext>Come again?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61338</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-12-09 22:20:29 +0000</bug_when>
    <thetext>I think the problem here was just that valueAsDate wasn&apos;t marked as nullable, but I&apos;m not sure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61590</commentid>
    <comment_count>3</comment_count>
    <who name="Kang-Hao (Kenny) Lu">kennyluck</who>
    <bug_when>2011-12-15 05:16:36 +0000</bug_when>
    <thetext>Apparently my one-liner did&apos;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(&apos;input&apos;);
input.type = &quot;date&quot;;
input.value = &quot;2011-12-15&quot;;
input.valueAsDate = new Date(&quot;hixie&quot;); // invalid date
alert(input.value);

This doesn&apos;t seem to be well-defined as various &quot;algorithm to convert a Date object to a string&quot; algorithms seem to miss this case (the &apos;undefined&apos; 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&apos;t have implementations close to this nit.

(In reply to comment #2)
&gt; I think the problem here was just that valueAsDate wasn&apos;t marked as nullable,
&gt; but I&apos;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)
&gt; Come again?

I don&apos;t understand. Could you elaborate?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63121</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-01-25 23:20:06 +0000</bug_when>
    <thetext>(new Date(&quot;bogus&quot;)) is exactly equivalent to (new Date(NaN)).

It&apos;s true that the spec didn&apos;t define how valueAsDate should handle a Date with a NaN time value. I have now fixed that. Thanks for the bug report!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63122</commentid>
    <comment_count>5</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-01-25 23:20:42 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6918.
Check-in comment: Define how valueAsDate&apos;s setter should handle a NaN time value.
http://html5.org/tools/web-apps-tracker?from=6917&amp;to=6918</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>