W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

[Bug 22824] New: Remove Date from WebIDL

From: <bugzilla@jessica.w3.org>
Date: Sun, 28 Jul 2013 23:21:53 +0000
To: public-script-coord@w3.org
Message-ID: <bug-22824-3890@http.www.w3.org/Bugs/Public/>

            Bug ID: 22824
           Summary: Remove Date from WebIDL
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebIDL
          Assignee: cam@mcc.id.au
          Reporter: jonas@sicking.cc
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, public-script-coord@w3.org

As per this[1] thread on es-discuss, it is generally not appropriate to return
Date objects from getters or from functions.

In situations when a time-stamp is desired, it's better to simply return a
integer represting "the number of milliseconds elapsed since 1 January 1970
00:00:00 UTC".

In situations when a time-stamp + timezone is needed, a Date objects is not
appropriate since it can't represent arbitrary timezones.

We should however count on that there is existing (and new) code that uses Date
objects. So we should make setters and functions accept Date objects as
argument. But in all those cases should we also accept numeric timestamps.

But since Date objects per normal ES coercion rules can be coerced into a
number, all that we need to do in the IDL is to make the setter or function
accept a numeric timestamp. That will automatically make Date objects also

There might be cases where accepting or treating Date objects different from
numeric objects. But in those cases prose could always be used. And at the very
least we shouldn't worry about these cases until we actually have concrete

As far as I know no legacy APIs need to return Date objects or accept Date
objects and treat them differently from numeric timestamps. The only stable API
on the web that I can think of that uses Date objects is IndexedDB. However it
needs to use prose anyway since in cases where it accepts Date objects it also
accepts many other types of values that can't be expressed as a simple union.

[1] http://esdiscuss.org/topic/frozen-date-objects

You are receiving this mail because:
You are on the CC list for the bug.
Received on Sunday, 28 July 2013 23:21:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:17 UTC