[squeak-dev] Date hash is broken

Chris Cunningham cunningham.cb at gmail.com
Wed Oct 17 16:25:16 UTC 2018


Hi Alistair,

which version of Squeak are you using?  The latest version I get
 {true . false . 2018-10-17T00:00:00-07:00 . 1:00:00:00 .
2018-10-17T00:00:00+00:00 . 1:00:00:00}
from the results of your script.  Maybe you are using Pharo?  Back in Feb
2016 the default offset for timespans (and hence the default offset for
Date) was set to nil - meaning for the display the Date today should show
+0:00 (which is not nil, obviously, but prints better).

-Chris

On Wed, Oct 17, 2018 at 8:21 AM Alistair Grant <akgrant0710 at gmail.com>
wrote:

> Hi Chris,
>
> On Wed, 17 Oct 2018 at 16:36, Chris Cunningham <cunningham.cb at gmail.com>
> wrote:
> >
> > Hi.
> >
> > Following a thread in Pharo where two dates that are equal weren't
> usable in a Dictionary as keys, I wondered if the same thing is true in
> Squeak.  It is, unfortunately.  I can't use the same code as given in the
> Pharo example (we don't have a #translateToUTC), but equivalent code shows
> the issue:
> >
> > d1 := DateAndTime now asDate.
> > d2 := Date today.
> > d1 = d2. "true"
> > d1 hash = d2 hash. "false"
> >
> > I'll get around to fixing the hash in the next day or so, when I get a
> chance to figure out how.
>
> I get true for both comparisons.
>
> What's the result of:
>
> | d1 d2 |
>
> d1 := DateAndTime now asDate.
> d2 := Date today.
> {
> d1 = d2.
> d1 hash = d2 hash.
> d1 start.
> d1 duration.
> d2 start.
> d2 duration. }
>
> " an Array(
> true
> true
> 2018-10-17T00:00:00+02:00
> 1:00:00:00
> 2018-10-17T00:00:00+02:00
> 1:00:00:00)"
>
> Cheers,
> Alistair
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20181017/5dd66504/attachment.html>


More information about the Squeak-dev mailing list