[whatwg] valueAsNumber: float is not enough

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element
<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element>

          attribute float valueAsNumber  
<http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#dom-input-valueasnumber>;


valueAsNumber is defined as float, IEEE754 single precision number.
It should be double because number values for date and time types are
milliseconds from UNIX epoch.  As of today, milliseconds from UNIX epoch is
about 1,264,492,163,000.  The float type can't represent this value
precisely.
If we do the following with float valueAsNumber, the input value loses the
data.
   input.type = "datetime";
   input.value = "2010-01-26T08:00Z";
   var num = input.valueAsNumber;
   input.valueAsNumber = num;

-- 
TAMURA Kent
Software Engineer, Google



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100126/2c6e00a8/attachment.htm>

Received on Tuesday, 26 January 2010 00:07:43 UTC