W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2009

Re: DOMTimeStamp interface not defined in L3 events...

From: Jacob Rossi <rossi@gatech.edu>
Date: Sun, 4 Oct 2009 15:28:16 -0400
Message-ID: <b1dbfad70910041228x3a3e5d59jc2f8c670a13704a5@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: annevk@opera.com, www-dom@w3.org, travil@microsoft.com
> Can't you do
>  var jsdate = new Date(e.timeStamp);
> ...? (Might need a factor of 1000 multiplier.)

Doesn't work for me. Test page:   http://www.jacobrossi.com/eventdates.html

In Firefox,
The value of e.timeStamp *looks* like a UNIX timestamp (milliseconds
since Jan. 1, 1970 midnight), which is what MDC documentation led me
to believe it should be. However, it's not a correct timestamp and is
not off by a simple factor of 1000 or something. Further, trying to
convert an example of a HTML5 "valid date and time string" using the
date.parse does not work.

In Chrome,
The value of e.timeStamp is a date object. Also, the date.parse()
method is unable to convert the example date and time string from

I think using a JS date object makes the most sense (especially since
it's easy to go from a date object to either a date/time string OR
unix timestamp). But if there are sites that expect this to be unix
timestamp or date string, then this would break them.


On Sat, Oct 3, 2009 at 10:03 PM, Ian Hickson <ian@hixie.ch> wrote:
> On Sat, 3 Oct 2009, Jacob Rossi wrote:
>> Annevk wrote:
>> > I believe last time we looked into this it was figured out we could not
>> > change it to a Date object. I wish we could, but there is probably too
>> > much content out there using it in this way already.
>> It probably does have to stay the say it is for backwards
>> compatibility. But it sure would be nice to be able to do something
>> like:
>> var jsdate = e.timeStamp.toDate();
> Can't you do
>  var jsdate = new Date(e.timeStamp);
> ...? (Might need a factor of 1000 multiplier.)
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Sunday, 4 October 2009 19:29:11 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:15 UTC