[squeak-dev] TimeZone Check-In

Ron Teitelbaum ron at usmedrec.com
Wed Sep 4 22:06:23 UTC 2019


Hi Sean,

I'm sure I'm stepping on a mine field here but I'll give it a go.  A date
without a time should not have a meaningful timezone offset. If for some
reason the implementation requires an offset it should have some
meaningless offset added.  It does give you the local timezone which may be
of some value to dates although why is a mystery to me. Unless you have a
time to go with it it seems meaningless.  Anyway assuming there is a value
to an offset on a date Note that

TimeSpan >> asDate
    ^start asDate.

This makes sense to me because it just sets the time offset to midnight.

start on TimeSpan and Date is a DateAndTime

DateAndTime >> asDate
    ^ Date starting: self

Date class >> starting: aDateAndTime
    ^super starting: (aDateAndTime midnight) duration: (Duration days: 1)

Date on the other hand just returns self.

if

Date >> asDate
    ^start asDate,

like TimeSpan does then you could recreate the dates as you go and come
closer to fixing your problem by doing

aDate asDate = '1/1/1901' asDate.  Now the error window is much much
smaller because it still matters when asDate is performed.

Another fix is to just compare what you are actually concerned about.

aDate yyyymmdd = '1/1/1901' asDate yyyymmdd

Still I'm not sure there is a value in having the offset and maybe dates
should just be dates. :)

All the best,

Ron Teitelbaum

On Wed, Sep 4, 2019 at 12:52 PM Sean P. DeNigris <sean at clipperadams.com>
wrote:

> Did the recent changes to Squeak's Date/Time handling (or any 3rd party
> lib)
> ever solve the following longstanding Chronology bug:
>
> >Consider this thought experiment:
> > At 11:59pm before DST changes, eval aDate := '1/1/1901' asDate.
> > Now, wait two minutes and at 12:01am eval self assert: '1/1/1901' asDate
> =
> > aDate and… whammo, an exception!
> > The "different" offsets render equal dates unequal depending on when the
> > objects were created.
> > The fact that the offset is the one active at object creation is the key
> > error, because it should be the offset active when the date occurred.
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190904/d4e57181/attachment.html>


More information about the Squeak-dev mailing list