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

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

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Sun, 04 Oct 2009 23:32:46 +0300
Message-ID: <4AC9066E.2090301@helsinki.fi>
To: Jacob Rossi <rossi@gatech.edu>
CC: Ian Hickson <ian@hixie.ch>, annevk@opera.com, www-dom@w3.org, travil@microsoft.com
On 10/4/09 10:28 PM, Jacob Rossi wrote:
>> 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.
This is a bug in Gecko. There is a patch waiting for reviews to get
this working according to the D3E draft - return value in milliseconds.


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.
Um.


  Also, the date.parse()
> method is unable to convert the example date and time string from
> HTML5.
>
>
> 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.

Well, it is easy to get JS Date object from milliseconds too.


-Olli


>
> --Jacob
>
>
>
> 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 20:33:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:03 GMT