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



Reply via email to