Independent Date and Time objects/ISO Dates
Lars T Hansen
lth at acm.org
Mon Jul 30 04:41:37 PDT 2007
On 5/23/07, Brendan Eich <brendan at mozilla.org> wrote:
> On May 16, 2007, at 10:37 AM, Lars T Hansen wrote:
> > Ah. No, we've not talked about doing that, and you don't get to set a
> > bit on the Date object that says "the time does not matter". I
> > suppose you could, but I don't (yet) know what the consequences are.
> > For backwards compatibility a date string probably needs to yield a
> > Date object with a time. For ISO strings we could conceivably do
> > something different, but I'm not sure about that.
> We're talking about this thread in the TG1 meeting now. It would help
> us to see how you've worked around Date to meet your use-cases. We
> think a few lines of JS can force a fit, but we're interested to see
> what you did. We don't plan to add a strftime-like API, but if we're
> right about the few-lines scale of adaptation, that might fit in a
> standard method or two.
Part of the problem is that Date.parse does not yield a Date object,
but a timestamp, so retaining information about what was and wasn't
part of the time stamp requires a new parsing API.
IMO we should not take the Date class further than we've taken it.
Given the regularity of the ISO date format, it's reasonably
convenient to subclass Date and add parsers/serializer; JSON clients
can override toJSONString or even toISOString. And so on.
More information about the Es4-discuss