> On 16 Oct 2018, at 22:27, Alistair Grant <akgrant0...@gmail.com> wrote:
>
> Hi Petr,
>
> On Tue, 16 Oct 2018 at 21:25, Petr Fischer via Pharo-users
> <pharo-users@lists.pharo.org> wrote:
>>
>> My problem - use Dates as Dictionary keys - shortly:
>>
>> d1 := Date today translateToUTC.
>> d2 := Date today.
>>
>> d1 = d2. (true!)
>
> Which timezone are you in?
>
> CEDT (UTC+0200) gives false for this.
>
> Date is implemented primarily as a timespan, so days in different
> timezones are considered different. If you do:
>
> | d1 d2 |
>
> d1 := Date today translateTo: (TimeZone abbreviated: 'UTC') offset.
> d2 := Date today translateTo: (TimeZone abbreviated: 'EST') offset.
>
> { d1 = d2. d1 equals: d2 }
>
>
> You can see the difference.
>
> Of course, this doesn't help with using Date as a key in a dictionary.
> Probably your best option is to look at Sven's excellent ZTimezone
> package (although I haven't tested it in this scenario).
>
> I can't find the repository right now (I think Sven moved it to github).
> Sven?
It is called ZTimestamp and it lives in various places, for example:
https://github.com/svenvc/ztimestamp
> Cheers,
> Alistair
>
>
>
>> d := Dictionary new.
>> d at: d1 put: 1.
>>
>> d at: d1. (ok)
>> d at: d2. (bad - key not found)
>>
>> ---
>>
>> pf
>>
>