W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

[IndexedDB/WebIDL] Dates + Sorting (WAS: Detailed comments for the current draft)

From: Jeremy Orlow <jorlow@chromium.org>
Date: Thu, 22 Apr 2010 13:08:28 -0700
Message-ID: <w2h5dd9e5c51004221308q1092517hfd8ac5c518a56aef@mail.gmail.com>
To: Pablo Castro <Pablo.Castro@microsoft.com>
Cc: Nikunj Mehta <nikunj@o-micron.com>, "public-webapps@w3.org" <public-webapps@w3.org>, Ian Hickson <ian@hixie.ch>, Sam Weinig <weinig@apple.com>, Cameron McCormack <cam@mcc.id.au>
On Tue, Feb 2, 2010 at 8:37 PM, Pablo Castro <Pablo.Castro@microsoft.com>wrote:

> On Mon, Feb 1, 2010 at 1:30 AM, Jeremy Orlow <jorlow@google.com> wrote:
> > > > 1. Keys and sorting
> > > > a.       3.1.1:  it would seem that having also date/time values as
> keys would be important and it's a common sorting criteria (e.g. as part of
> a composite primary key or in general as an index key).
> > > The Web IDL spec does not support a Date/Time data type. Could your use
> case be supported by storing the underlying time with millisecond precision
> using an IDL long long type? I am willing to change the spec so that it
> allows long long instead of long IDL type, which will provide adequate
> support for Date and time sorting.
> > Can the spec not be augmented?  It seems like other specs like WebGL have
> created their own types.  If not, I suppose your suggested change would
> suffice as well.  This does seem like an important use case.
> I agree, either we could augment the spec or we could describe it in terms
> of Javascript object values. That is, we can say something specific about
> the treatment of Javascript's Date object. Would that be possible? E.g. we
> could require implementations to provide full order for dates if they find
> an instance of that type in a path.

I took a look at the WebIDL spec and found the following text:

Editorial note

HTML 5 uses Date<http://lists.w3.org/Archives/Public/public-webapps/2009JanMar/0458.html>,
so we'll need to decide what to do with that.

Current thoughts are to be able to state that an interface has a custom
mapping to language bindings, and to map that type to a Date in ECMAScript
and a java.util.Date in Java.

Does this comment imply that there are differences in how the two languages
treat dates?  Or is the concern that other languages that WebIDL might apply
to might have different semantics?

The HTML5 spec seems to specify the parsing of dates in great detail, but
I'm not sure whether it completely covers everything.  For example, are
there nuances to sort order that we need to be concerned with?  Since the
HTML5 spec only allows gregorian calendar dates, comparing based on the
number of seconds since epoch seems like it'd be enough.  But I'm really not
an expert on this stuff...

Does anyone have advice on how would be best for the IndexedDB spec to
include indexing/ordering based on dates?

Received on Thursday, 22 April 2010 20:09:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:07 UTC