Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home for dartlang.org
« Groups Home
Date refactoring
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 36 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Florian Loitsch  
View profile  
 More options May 14 2012, 9:59 am
From: Florian Loitsch <floit...@google.com>
Date: Mon, 14 May 2012 15:59:12 +0200
Local: Mon, May 14 2012 9:59 am
Subject: Date refactoring

I'm in the process of refactoring the corelib's Date class, and would like
to get some feedback on this.

The idea is to make it easier to use for the general case, and *not*
implement a feature complete Date library. We eventually need something
like Java's Joda library, but such a library would be way too big for the
corelib and would confuse most people (Dates, DateTimes, and TimeZones are
unfortunately pretty complicated...).

As a first step I want to do the modifications I propose in CL
https://chromiumcodereview.appspot.com/10384149
That is: remove the TimeZone class, make Date hashable, add optional
arguments to the constructor and add a way to get to the TimeZone(offset).
The biggest change in the CL is that it would not be possible to get to the
UTC fields anymore. There would be a toUTCString() but no utcMonth (or any
other getter).
The reasoning is that timezone-independent operations almost always only
want the epoch-time (which is accessible through the 'value' field), or
print it (for logging). Both use-cases are still covered.

Related bugs:
Optional arguments: http://dartbug.com/1422 and http://dartbug.com/2582.
Hashable: http://dartbug.com/2400
Timezone offset: http://dartbug.com/2579

The following bugs would be obsolete if I go ahead with my changes:
TimeZone utc/local constructors should be constants: http://dartbug.com/2581
DateImplementation doesn't check for required timezone argument:
http://dartbug.com/1260

I also propose closing http://dartbug.com/1424 (Split into Date and
TimeStamp). This is outside the scope of the corelib.

And since I start the discussion on Dates we should maybe also look at
adding support for some other epochs:
http://en.wikipedia.org/wiki/Epoch_(reference_date)#Notable_epoch_dat...
Personally I don't see any good candidate, but I remember vaguely that at
least one of those is commonly used. But that could be bad memory...

We should also consider:
Rename the time getters (d.hours -> d.hour, d.minutes -> d.minute, ...):
http://dartbug.com/1985

// florian
--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Brauner  
View profile  
 More options May 14 2012, 10:31 am
From: Paul Brauner <po...@google.com>
Date: Mon, 14 May 2012 16:31:05 +0200
Local: Mon, May 14 2012 10:31 am
Subject: Re: [misc] Date refactoring

Something I often need is the equivalent of Date.fromEpoch but with
human-readable arguments. Otherwise I keep going to
http://www.epochconverter.com/ and I put the human-readable UTC date in a
comment next to the timestamp. It doesn't add any expressivity, just
readability.

Paul

On Mon, May 14, 2012 at 3:59 PM, Florian Loitsch <floit...@google.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ladislav Thon  
View profile  
 More options May 14 2012, 10:31 am
From: Ladislav Thon <ladi...@gmail.com>
Date: Mon, 14 May 2012 16:31:42 +0200
Local: Mon, May 14 2012 10:31 am
Subject: Re: [misc] Date refactoring

Hi,

The idea is to make it easier to use for the general case, and *not*

> implement a feature complete Date library. We eventually need something
> like Java's Joda library, but such a library would be way too big for the
> corelib and would confuse most people (Dates, DateTimes, and TimeZones are
> unfortunately pretty complicated...).

> As a first step I want to do the modifications I propose in CL
> https://chromiumcodereview.appspot.com/10384149

if I understand correctly, your argument and your code is based on the
assumption that timezones are hard, make the code complicated and in a vast
majority of situations, they aren't even necessary. I completely and
wholeheartedly agree. Having the corelib's date/time support as much
timezones-free as possible is a goal I can identify with.

From looking at the proposed Date interface, it looks like it can't be
completely timezones-free (because even the unix timestamp value refers to
UTC), so instead, the date is implicitly in local timezone. Correct? I
guess I can live with that.

> I also propose closing http://dartbug.com/1424 (Split into Date and
> TimeStamp). This is outside the scope of the corelib.

I still believe that having separate Date and DateTime in the corelib (both
of them in local timezone) is extremely valuable, because using date+time
value for modeling date value gets inconvenient pretty quickly. I'm
obviously not the one to decide what is in corelib's scope and what isn't,
but I'd plead for considering this once more.

LT


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Loitsch  
View profile  
 More options May 14 2012, 10:41 am
From: Florian Loitsch <floit...@google.com>
Date: Mon, 14 May 2012 16:41:06 +0200
Local: Mon, May 14 2012 10:41 am
Subject: Re: [misc] Date refactoring

Correct: no (explicit) timezones in the corelib.

> From looking at the proposed Date interface, it looks like it can't be
> completely timezones-free (because even the unix timestamp value refers to
> UTC), so instead, the date is implicitly in local timezone. Correct? I
> guess I can live with that.

Yes. Dates will always be (implicitly) in the local timezone.

>> I also propose closing http://dartbug.com/1424 (Split into Date and
>> TimeStamp). This is outside the scope of the corelib.

> I still believe that having separate Date and DateTime in the corelib
> (both of them in local timezone) is extremely valuable, because using
> date+time value for modeling date value gets inconvenient pretty quickly.
> I'm obviously not the one to decide what is in corelib's scope and what
> isn't, but I'd plead for considering this once more.

From my point of view the biggest problem is that there is a lot of
pressure to make "Date" the DateTime class leaving no good name for the
actual Date class. I will think about this, but I think I would rather make
working with Dates easier by providing something like an "Interval" class
(similar to the Duration class) that deals nicer with Dates. For example:
date + new Interval(months: 3, days: 1)

> LT

--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Loitsch  
View profile  
 More options May 14 2012, 10:43 am
From: Florian Loitsch <floit...@google.com>
Date: Mon, 14 May 2012 16:43:06 +0200
Local: Mon, May 14 2012 10:43 am
Subject: Re: [misc] Date refactoring

On Mon, May 14, 2012 at 4:31 PM, Paul Brauner <po...@google.com> wrote:
> Something I often need is the equivalent of Date.fromEpoch but with
> human-readable arguments. Otherwise I keep going to
> http://www.epochconverter.com/ and I put the human-readable UTC date in a
> comment next to the timestamp. It doesn't add any expressivity, just
> readability.

I would use Date.fromString("ISO8601") for this. It would of course be
slower, but that would be the case for anything that doesn't provide the
epoch value.

--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Grobmeier  
View profile  
 More options May 14 2012, 10:46 am
From: Christian Grobmeier <grobme...@gmail.com>
Date: Mon, 14 May 2012 16:46:27 +0200
Local: Mon, May 14 2012 10:46 am
Subject: Re: [misc] Date refactoring

How should that look like? In the past years I needed access to
perfect timezone support (I am a Joda fan) and really cannot imagine
how it would work without.

>> From looking at the proposed Date interface, it looks like it can't be
>> completely timezones-free (because even the unix timestamp value refers to
>> UTC), so instead, the date is implicitly in local timezone. Correct? I guess
>> I can live with that.

> Yes. Dates will always be (implicitly) in the local timezone.

Horrible outlook if I can't change the timezone.
Maybe I miss something, but if not, please reconsider. I constantly
need timezone calculations and would like to avoid writing my own lib.

That being said time in millis is always useful.

--
http://www.grobmeier.de
https://www.timeandbill.de

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Loitsch  
View profile  
 More options May 14 2012, 10:52 am
From: Florian Loitsch <floit...@google.com>
Date: Mon, 14 May 2012 16:52:43 +0200
Local: Mon, May 14 2012 10:52 am
Subject: Re: [misc] Date refactoring

On Mon, May 14, 2012 at 4:46 PM, Christian Grobmeier <grobme...@gmail.com>wrote:

Similar to Java this functionality would be provided by a separate library.
If you need the complexity then you have to ask for it.
One reason for this (as already mentioned) is not to confuse developers
that just want to do simple Date operations. The other is, that a Joda like
library requires a lot of space; both in terms of code-size as well as in
data.

> >> From looking at the proposed Date interface, it looks like it can't be
> >> completely timezones-free (because even the unix timestamp value refers
> to
> >> UTC), so instead, the date is implicitly in local timezone. Correct? I
> guess
> >> I can live with that.

> > Yes. Dates will always be (implicitly) in the local timezone.

> Horrible outlook if I can't change the timezone.
> Maybe I miss something, but if not, please reconsider. I constantly
> need timezone calculations and would like to avoid writing my own lib.

Somebody will have to write (or port) a lib, but with a little bit of luck
it will not be you ;)

--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ladislav Thon  
View profile  
 More options May 14 2012, 10:56 am
From: Ladislav Thon <ladi...@gmail.com>
Date: Mon, 14 May 2012 16:56:05 +0200
Local: Mon, May 14 2012 10:56 am
Subject: Re: [misc] Date refactoring

> > Correct: no (explicit) timezones in the corelib.

> How should that look like? In the past years I needed access to
> perfect timezone support (I am a Joda fan) and really cannot imagine
> how it would work without.

Even JodaTime (and ThreeTen too, IIRC) has Local[Date|DateTime|Time], and
from my experience, timezone-less date values are far more common than the
other ones. So I guess that the plan is to have a separate library with all
those bells, timezones and whistles, but keep some small and most useful
fraction of it right in the corelib.

LT


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
William Hesse  
View profile  
 More options May 14 2012, 10:57 am
From: William Hesse <whe...@google.com>
Date: Mon, 14 May 2012 16:57:41 +0200
Local: Mon, May 14 2012 10:57 am
Subject: Re: [misc] Date refactoring
Just so everyone is on the same page here:

A Date represents an absolute time (what many people would call a UTC
time) - an actual epoch value, that refers to
an instant that is the same around the world.  That will definitely not change.

Almost all of the functions for converting Dates to strings, and
getting hours, minutes, days, seconds from them, and for creating and
modifying dates will use the local time zone to convert to local time,
and will assume their inputs are in local time.  This is also the same
as before

Date is not really a good way for representing calendar days.  If you
make a Date from a calendar day, that Date is dependent on your local
timezone, and if its value as a Date object somehow gets to another
computer, it may not represent a time on that same day.  It is also
hard to add and subtract days, with summer daylight time changes
happening.  This makes the problem no better or worse.  The real
solution is a different object for calendar days, or a UTC calendar
day that is easy to use.

What the previous API had was storing the time zone (from creation)
along with the Date, and using that, rather than the current active
time zone, for input/output/conversion (I think).  Usually there would
be no difference between the two.

I would like to know if this makes it any harder to do input/output from UTC.

On Mon, May 14, 2012 at 4:46 PM, Christian Grobmeier

--
William Hesse
Software Engineer
whe...@google.com

Google Denmark ApS
Frederiksborggade 20B, 1 sal
1360 København K
Denmark
CVR nr. 28 86 69 84

If you received this communication by mistake, please don't forward it
to anyone else (it may contain confidential or privileged
information), please erase all copies of it, including all
attachments, and please let the sender know it went to the wrong
person. Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Grobmeier  
View profile  
 More options May 14 2012, 10:58 am
From: Christian Grobmeier <grobme...@gmail.com>
Date: Mon, 14 May 2012 16:58:29 +0200
Local: Mon, May 14 2012 10:58 am
Subject: Re: [misc] Date refactoring

>> > Correct: no (explicit) timezones in the corelib.

>> How should that look like? In the past years I needed access to
>> perfect timezone support (I am a Joda fan) and really cannot imagine
>> how it would work without.

> Similar to Java this functionality would be provided by a separate library.
> If you need the complexity then you have to ask for it.
> One reason for this (as already mentioned) is not to confuse developers that
> just want to do simple Date operations. The other is, that a Joda like
> library requires a lot of space; both in terms of code-size as well as in
> data.

I would find it pretty confusing if I can't fix my code because I have
no timezone avail :-)
I have learned there is no "simple date operation", even when it looks simple.

>> >> From looking at the proposed Date interface, it looks like it can't be
>> >> completely timezones-free (because even the unix timestamp value refers
>> >> to
>> >> UTC), so instead, the date is implicitly in local timezone. Correct? I
>> >> guess
>> >> I can live with that.

>> > Yes. Dates will always be (implicitly) in the local timezone.

>> Horrible outlook if I can't change the timezone.
>> Maybe I miss something, but if not, please reconsider. I constantly
>> need timezone calculations and would like to avoid writing my own lib.

> Somebody will have to write (or port) a lib, but with a little bit of luck
> it will not be you ;)

With my luck, I will write it :-)

In any case, if you can create a (readable) field naming the time zone
in which the date was created would probably help debugging.
And a chance to return the time in millis would be fine

--
http://www.grobmeier.de
https://www.timeandbill.de

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Grobmeier  
View profile  
 More options May 14 2012, 11:00 am
From: Christian Grobmeier <grobme...@gmail.com>
Date: Mon, 14 May 2012 17:00:05 +0200
Local: Mon, May 14 2012 11:00 am
Subject: Re: [misc] Date refactoring

On Mon, May 14, 2012 at 4:56 PM, Ladislav Thon <ladi...@gmail.com> wrote:
>> > Correct: no (explicit) timezones in the corelib.

>> How should that look like? In the past years I needed access to
>> perfect timezone support (I am a Joda fan) and really cannot imagine
>> how it would work without.

> Even JodaTime (and ThreeTen too, IIRC) has Local[Date|DateTime|Time], and
> from my experience, timezone-less date values are far more common than the
> other ones. So I guess that the plan is to have a separate library with all
> those bells, timezones and whistles, but keep some small and most useful
> fraction of it right in the corelib.

Like java.util.Date, the Calendar classes and Joda, which now becomes
part of the SDK?
Hope it will not cause more confusion than expected.

> LT

--
http://www.grobmeier.de
https://www.timeandbill.de

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ladislav Thon  
View profile   Translate to Translated (View Original)
 More options May 14 2012, 11:10 am
From: Ladislav Thon <ladi...@gmail.com>
Date: Mon, 14 May 2012 17:10:24 +0200
Local: Mon, May 14 2012 11:10 am
Subject: Re: [misc] Date refactoring

> Like java.util.Date, the Calendar classes and Joda, which now becomes
> part of the SDK?
> Hope it will not cause more confusion than expected.

I'm pretty sure that nowadays, noone would publish a date library similar
to java.util.Date or Calendar :-) And ThreeTen is quite different from
Joda. I'd love to have Stephen Colebourne (co)designing Dart's date
library, but I'm also sure that there already are some skilled people in
the Dart team.

A lot of applications (I'd argue that *majority* of applications) only
makes sense in a single timezone and their developers (myself included)
don't really understand this stuff. Let's not complicate their lifes.

LT


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Grobmeier  
View profile  
 More options May 14 2012, 11:23 am
From: Christian Grobmeier <grobme...@gmail.com>
Date: Mon, 14 May 2012 17:23:32 +0200
Local: Mon, May 14 2012 11:23 am
Subject: Re: [misc] Date refactoring

On Mon, May 14, 2012 at 5:10 PM, Ladislav Thon <ladi...@gmail.com> wrote:
>> Like java.util.Date, the Calendar classes and Joda, which now becomes
>> part of the SDK?
>> Hope it will not cause more confusion than expected.

> I'm pretty sure that nowadays, noone would publish a date library similar to
> java.util.Date or Calendar :-) And ThreeTen is quite different from Joda.

I am referring to the fact that java.util.Date has not timezone
support and gives you month/day/year etc. It is pretty simple and
sound pretty much like what is proposed: a simple Date class with a
single timezone.

> I'd love to have Stephen Colebourne (co)designing Dart's date library, but
> I'm also sure that there already are some skilled people in the Dart team.

It did not doubt that.

> A lot of applications (I'd argue that majority of applications) only makes
> sense in a single timezone and their developers (myself included) don't
> really understand this stuff. Let's not complicate their lifes.

I am not sure why these signatures are considered complicated or confusing:

new Date(); // fixed timezone or underlying os timezone
new Date.germany();
new Date.utc(5); // utc +5

I highly doubt that people who deal with Date don't need access to TimeZone.

Either I have had bad luck but the past years I constantly worked on
applications which needed timezones. I am also not talking about
creating a killer-lib like JodaTime but completely getting rid of
timezones sounds wrong to me.

But well, at least I hope the new Date-classes allow creating a proper
lib. Anyway without such a lib I cannot move to Dart, stable or not.

Cheers
Christian

> LT

--
http://www.grobmeier.de
https://www.timeandbill.de

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Loitsch  
View profile   Translate to Translated (View Original)
 More options May 14 2012, 11:37 am
From: Florian Loitsch <floit...@google.com>
Date: Mon, 14 May 2012 17:37:07 +0200
Local: Mon, May 14 2012 11:37 am
Subject: Re: Date refactoring

Adding Hashable: https://chromiumcodereview.appspot.com/10391109/

On Mon, May 14, 2012 at 3:59 PM, Florian Loitsch <floit...@google.com>wrote:

--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Eagan  
View profile  
 More options May 14 2012, 11:43 am
From: Sean Eagan <seaneag...@gmail.com>
Date: Mon, 14 May 2012 10:43:22 -0500
Local: Mon, May 14 2012 11:43 am
Subject: Re: [misc] Date refactoring

On Mon, May 14, 2012 at 9:41 AM, Florian Loitsch <floit...@google.com> wrote:
> From my point of view the biggest problem is that there is a lot of pressure
> to make "Date" the DateTime class leaving no good name for the actual Date
> class.

I would rename Date to Time, that is what Ruby and Go have:

http://www.ruby-doc.org/core-1.9.3/Time.html
http://golang.org/pkg/time/#Time

For the other interface, I would consider using Day instead of Date to
avoid any confusion with Date in Java/JavaScript.

'time of day' abstractions are not that common, but if needed, it
could be named TimeOfDay.

> I will think about this, but I think I would rather make working with
> Dates easier by providing something like an "Interval" class (similar to the
> Duration class) that deals nicer with Dates. For example: date + new
> Interval(months: 3, days: 1)

I think the term 'Interval' implies a contiguous interval between two
absolute values which are Comparable such as Date/Time, e.g.:

interface Interval<T extends Comparable> {
  Interval(T one, T other);

  final T start, end;
  bool contains(T test);

}

As far as modeling day, week, month, and year deltas independent of
daylight savings time, varying month lengths, and leap years, I think
this should be added directly to Duration, or at least a sub-interface
thereof.  This is tracked in http://dartbug.com/1426.

This can be done by having exact, non-additive fields for
milliseconds, days, and months, and then estimated additive getters
for all units, i.e. inMilliseconds ... inYears.

I mocked this up at:

https://gist.github.com/1979756

The Duration returned from Date/Time#difference would have a slightly
different implementation since it can provide exact values for the all
units, yet it would still only need to store a subset of milliseconds,
days, and months values internally.

Cheers,
Sean Eagan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
afsina  
View profile  
 More options May 15 2012, 8:00 am
From: afsina <ahme...@gmail.com>
Date: Tue, 15 May 2012 05:00:10 -0700 (PDT)
Local: Tues, May 15 2012 8:00 am
Subject: Re: Date refactoring

On May 14, 6:10 pm, Ladislav Thon <ladi...@gmail.com> wrote:

> > Like java.util.Date, the Calendar classes and Joda, which now becomes
> > part of the SDK?
> > Hope it will not cause more confusion than expected.

> I'm pretty sure that nowadays, noone would publish a date library similar
> to java.util.Date or Calendar :-) And ThreeTen is quite different from
> Joda. I'd love to have Stephen Colebourne (co)designing Dart's date
> library, but I'm also sure that there already are some skilled people in
> the Dart team.

> A lot of applications (I'd argue that *majority* of applications) only
> makes sense in a single timezone and their developers (myself included)
> don't really understand this stuff. Let's not complicate their lifes.

> LT

There is an interesting poll about names in JSR 310 - ThreeTen
( http://sourceforge.net/apps/mediawiki/threeten/index.php?title=ThreeTen
)
May be relevant with the discussion

https://www.rationalsurvey.com/studyPeriods/collect/stdy_perd_id/3775...

Ahmet


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Eagan  
View profile  
 More options May 15 2012, 11:25 am
From: Sean Eagan <seaneag...@gmail.com>
Date: Tue, 15 May 2012 10:25:16 -0500
Local: Tues, May 15 2012 11:25 am
Subject: Re: [misc] Date refactoring

On Mon, May 14, 2012 at 8:59 AM, Florian Loitsch <floit...@google.com> wrote:
> The idea is to make it easier to use for the general case, and *not*
> implement a feature complete Date library. We eventually need something like
> Java's Joda library, but such a library would be way too big for the corelib
> and would confuse most people (Dates, DateTimes, and TimeZones are
> unfortunately pretty complicated...).

I agree with keeping the size of dart:core down.  I don't agree that
providing micro date/time APIs in dart:core is the solution.  I think
these APIs would be abandoned, forever cluttering the top level
namespace of libraries, after a more full featured library came along.

I think a better option would be to provide a placeholder for that
more full featured library now, probably called "dart:time", which
contains Date, Duration, and TimeZone.  Having the local time zone as
the default already means you don't have to think about time zones if
you don't want to.  And if a better name were used instead of Date
(outside of computer science this refers to an entire day, not an
instant), such as Time, Instant, or Moment, then a class to represent
an entire day, called Date or Day, could be added to this library
either now or in the future.  Other things could be added in the
future as well as pain points are discovered.

Thoughts?

Cheers,
Sean


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Eagan  
View profile  
 More options May 15 2012, 12:21 pm
From: Sean Eagan <seaneag...@gmail.com>
Date: Tue, 15 May 2012 11:21:18 -0500
Local: Tues, May 15 2012 12:21 pm
Subject: Re: [misc] Date refactoring
This would also be a good time to discuss:

http://dartbug.com/2771

(Date constructor should allow arguments to overflow/underflow)

Cheers,
Sean


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Loitsch  
View profile  
 More options May 16 2012, 6:37 am
From: Florian Loitsch <floit...@google.com>
Date: Wed, 16 May 2012 12:37:38 +0200
Local: Wed, May 16 2012 6:37 am
Subject: Re: [misc] Re: Date refactoring

Afaics there are no results yet. They should be available soon, though.
When they are, don't hesitate to send an update to the list.
thanks,
// florian

> Ahmet

--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Loitsch  
View profile  
 More options May 16 2012, 6:41 am
From: Florian Loitsch <floit...@google.com>
Date: Wed, 16 May 2012 12:41:15 +0200
Local: Wed, May 16 2012 6:41 am
Subject: Re: [misc] Date refactoring

We are discussing moving even the simplified version of Date into its own
library (for instance "dart:date"). So far no conclusion has been reached.
Wrt the naming. Yes, keeping the names consistent would be a plus, but
"Date" seems to be pretty entrenched. Also, because there is just no really
good substitute. None of DateTime, Time, Instant or Moment is something
that is easily found.
// florian

> Cheers,
> Sean

--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam McCall  
View profile  
 More options May 16 2012, 7:00 am
From: Sam McCall <sammcc...@google.com>
Date: Wed, 16 May 2012 12:00:21 +0100
Local: Wed, May 16 2012 7:00 am
Subject: Re: [misc] Date refactoring

On Wed, May 16, 2012 at 11:41 AM, Florian Loitsch <floit...@google.com>wrote:

> We are discussing moving even the simplified version of Date into its own
> library (for instance "dart:date").

+1

> Wrt the naming. Yes, keeping the names consistent would be a plus, but
> "Date" seems to be pretty entrenched. Also, because there is just no really
> good substitute. None of DateTime, Time, Instant or Moment is something
> that is easily found.

I think 'Date' is entrenched, but everyone has different expectations of it:

   - New developers expect it to be a calendar date with no time attached
   (as in English)
   - People familiar with other languages expect it to have a timezone,
   defaulting to local
   - And Dart is (sensibly) considering making it a UTC timestamp

I think 'Instant' is a better name, because:

   - Its plain-English meaning is closer to a timestamp than 'Date'
   - It's not misleadingly similar different concepts from other languages
      - most won't know it at all
      - people familiar with Joda will get the correct idea
      - people won't complain about it being different, most Date APIs suck
   - There will be less pressure to include formatting methods (and thus
   timezone logic) in this class if it's called Instant vs Date.

Cheers,
Sam


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ladislav Thon  
View profile  
 More options May 16 2012, 8:44 am
From: Ladislav Thon <ladi...@gmail.com>
Date: Wed, 16 May 2012 14:44:15 +0200
Local: Wed, May 16 2012 8:44 am
Subject: Re: [misc] Date refactoring

+∞ to what Sam said. Extracting date stuff to separate library works fine
for me -- and it's a great opportunity to route people in the right
direction where the full-featured timezone-aware date library will be.

LT


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Eagan  
View profile  
 More options May 16 2012, 9:21 am
From: Sean Eagan <seaneag...@gmail.com>
Date: Wed, 16 May 2012 08:21:38 -0500
Local: Wed, May 16 2012 9:21 am
Subject: Re: [misc] Date refactoring

On Wed, May 16, 2012 at 5:41 AM, Florian Loitsch <floit...@google.com> wrote:
> We are discussing moving even the simplified version of Date into its own
> library (for instance "dart:date"). So far no conclusion has been reached.

Glad to hear that it is being considered.  I assume Duration,
Stopwatch, Timer, Clock (and TimeZone if it were kept) would also be
moved there ?

In this case I think "dart:time" would be a much better name since
durations, stopwatches, and timers don't have much to do with dates,
but _are_ related to the concept of time.  Here are some existing
libraries which use "time" as the library name:

http://docs.python.org/library/time.html
http://golang.org/pkg/time/
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/time/rdoc/index.html
http://threeten.sourceforge.net/apidocs-2012-04-24/javax/time/package...

> Wrt the naming. Yes, keeping the names consistent would be a plus

It's not just about consistency within Dart, but consistency with
English as well :).

> "Date" seems to be pretty entrenched.

But the _trend_ is moving away from "Date".  Joda and eventually
ThreeTen use "Instant" / "DateTime", moment.js (http://momentjs.com)
uses "Moment".  Go and Ruby use "Time".  Python uses "DateTime".

> Also, because there is just no really
> good substitute. None of DateTime, Time, Instant or Moment is something that
> is easily found.

These all seem like improvements over "Date".  And if this is in a
small "dart:time" library, then it should be quite easily found, once
the library itself is found at http://api.dartlang.org.

Cheers,
Sean Eagan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Loitsch  
View profile  
 More options May 16 2012, 11:58 am
From: Florian Loitsch <floit...@google.com>
Date: Wed, 16 May 2012 17:58:28 +0200
Local: Wed, May 16 2012 11:58 am
Subject: Re: [misc] Date refactoring

The problem with "Instant" is that it clashes with threeten. There
"Instant" is just a wrapper around the epoch-value. The equivalent class
would be "ZonedDateTime" and that's a no go for the simplified class name.

>    - Its plain-English meaning is closer to a timestamp than 'Date'
>    - It's not misleadingly similar different concepts from other languages
>       - most won't know it at all
>       - people familiar with Joda will get the correct idea
>       - people won't complain about it being different, most Date APIs
>       suck
>    - There will be less pressure to include formatting methods (and thus
>    timezone logic) in this class if it's called Instant vs Date.

> Cheers,
> Sam

--
Give a man a fire and he's warm for the whole day,
but set fire to him and he's warm for the rest of his life. - Terry
Pratchett

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam McCall  
View profile  
 More options May 16 2012, 12:40 pm
From: Sam McCall <sammcc...@google.com>
Date: Wed, 16 May 2012 18:40:59 +0200
Local: Wed, May 16 2012 12:40 pm
Subject: Re: [misc] Date refactoring

On Wed, May 16, 2012 at 5:58 PM, Florian Loitsch <floit...@google.com>wrote:

I'm confused, I thought we were talking about a 'wrapper around an
epoch-value' - that's the baseline that I'd expect to be (almost) part of
the language.

Once you start including timezones then the complexity comes in, and I
agree there's not a great name for that - but it would be one name among
several in such a library (c.f. joda/threeten) and so it would be easier to
draw distinctions through a naming system.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 36   Newer >
« Back to Discussions « Newer topic     Older topic »