W3C home > Mailing lists > Public > public-html@w3.org > April 2016

RE: valueAsDate for input@type=datetime-local

From: Manuel Strehl <svg@manuel-strehl.de>
Date: Wed, 20 Apr 2016 08:52:13 +0200
To: public-html@w3.org
Message-ID: <4fa5b5279aa06f4d3c94401de69cc1d5@xa8.serverdomain.org>
> I'm guessing the reason is because JavaScript Date is a global time
> (includes a timezone), and datetime-local is a "floating" time (no
> timezone). Without the context of a timezone, you can't convert from
> floating to global time.

Sounds reasonable, but valueAsNumber applies and gives back a timestamp. 
I could feed that timestamp back into a Date object manually:

     new Date(input.valueAsNumber);

to get a date representing that timestamp. So I reason, it should be 
either both valueAsDate and valueAsNumber, that apply, or none.

--Manuel
Received on Wednesday, 20 April 2016 06:52:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 20 April 2016 06:52:38 UTC