STON and persisting Dates - problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

STON and persisting Dates - problem

Pharo Smalltalk Users mailing list
Hello,

if I persist Dictionary with Date keys with STON, there is a problem.

STON serializes Dates as: Date [ '2018-10-16' ] - there is no info about timezone.

So if I put a key "Date now translateToUTC" into dictionary, save to STON file, and then load again from STON file, Dictionary Date keys are restored in local time zone, so the keys in Dictionary is different - so after deserialize from STON file I can't find anything in Dictionary anymore.

Should I use ZTimestamp? :)

Thanks, pf

Reply | Threaded
Open this post in threaded view
|

Re: STON and persisting Dates - problem

Sven Van Caekenberghe-2
Petr,

You should use the latest STON, where Dates are now serialised with a timezone indicator.

Sven

> On 16 Oct 2018, at 19:59, Petr Fischer via Pharo-users <[hidden email]> wrote:
>
>
> From: Petr Fischer <[hidden email]>
> Subject: STON and persisting Dates - problem
> Date: 16 October 2018 at 19:59:55 GMT+2
> To: [hidden email]
>
>
> Hello,
>
> if I persist Dictionary with Date keys with STON, there is a problem.
>
> STON serializes Dates as: Date [ '2018-10-16' ] - there is no info about timezone.
>
> So if I put a key "Date now translateToUTC" into dictionary, save to STON file, and then load again from STON file, Dictionary Date keys are restored in local time zone, so the keys in Dictionary is different - so after deserialize from STON file I can't find anything in Dictionary anymore.
>
> Should I use ZTimestamp? :)
>
> Thanks, pf
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: STON and persisting Dates - problem

Pharo Smalltalk Users mailing list
You mean "development" version, right? Will it be available in stable version? Thanks! pf


> Petr,
>
> You should use the latest STON, where Dates are now serialised with a timezone indicator.
>
> Sven
>
> > On 16 Oct 2018, at 19:59, Petr Fischer via Pharo-users <[hidden email]> wrote:
> >
> >
> > From: Petr Fischer <[hidden email]>
> > Subject: STON and persisting Dates - problem
> > Date: 16 October 2018 at 19:59:55 GMT+2
> > To: [hidden email]
> >
> >
> > Hello,
> >
> > if I persist Dictionary with Date keys with STON, there is a problem.
> >
> > STON serializes Dates as: Date [ '2018-10-16' ] - there is no info about timezone.
> >
> > So if I put a key "Date now translateToUTC" into dictionary, save to STON file, and then load again from STON file, Dictionary Date keys are restored in local time zone, so the keys in Dictionary is different - so after deserialize from STON file I can't find anything in Dictionary anymore.
> >
> > Should I use ZTimestamp? :)
> >
> > Thanks, pf
> >
> >
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: STON and persisting Dates - problem

Sven Van Caekenberghe-2


> On 16 Oct 2018, at 21:29, Petr Fischer via Pharo-users <[hidden email]> wrote:
>
>
> From: Petr Fischer <[hidden email]>
> Subject: Re: [Pharo-users] STON and persisting Dates - problem
> Date: 16 October 2018 at 21:29:22 GMT+2
> To: [hidden email]
>
>
> You mean "development" version, right? Will it be available in stable version? Thanks! pf

Yes and yes (modulo feedback)

>> Petr,
>>
>> You should use the latest STON, where Dates are now serialised with a timezone indicator.
>>
>> Sven
>>
>>> On 16 Oct 2018, at 19:59, Petr Fischer via Pharo-users <[hidden email]> wrote:
>>>
>>>
>>> From: Petr Fischer <[hidden email]>
>>> Subject: STON and persisting Dates - problem
>>> Date: 16 October 2018 at 19:59:55 GMT+2
>>> To: [hidden email]
>>>
>>>
>>> Hello,
>>>
>>> if I persist Dictionary with Date keys with STON, there is a problem.
>>>
>>> STON serializes Dates as: Date [ '2018-10-16' ] - there is no info about timezone.
>>>
>>> So if I put a key "Date now translateToUTC" into dictionary, save to STON file, and then load again from STON file, Dictionary Date keys are restored in local time zone, so the keys in Dictionary is different - so after deserialize from STON file I can't find anything in Dictionary anymore.
>>>
>>> Should I use ZTimestamp? :)
>>>
>>> Thanks, pf
>>>
>>>
>>>
>>
>
>
>