Voyage and Date

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

Voyage and Date

HilaireFernandes
Hi,

Not sure it is related to this:
http://forum.world.st/Possible-bug-with-Voyage-Mongo-date-tt4735597.html

But a date 1966-2-17 is persisted as a DateAndtime of value
1966-02-16T23:00:00+00:00 in the repository, which when retrieve will
then be 1996-16-2, and so on....

Exactly the utc time for a local 1966-17-2T00:00:00+00:00

Could it be the implicated code? :

(GratuitousIncompatibilities intToDateAndTime:
(GratuitousIncompatibilities dateToMilliseconds: '1966-2-17' asDate)) asDate
=> 16 Février 1966


And even worst:
(GratuitousIncompatibilities intToDate: (GratuitousIncompatibilities
dateToMilliseconds: '1966-2-17' asDate)) asDate
=>  15 Février 1966

Hilaire

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

HilaireFernandes
Concerning this problem, one option I found is to get far away of the
Voyage/Mongo Date/DateAndTime representation/conversion and stick to
string, not really efficience, but well...

mongoBirthday
<mongoDescription>
^ VOToOneDescription new
        attributeName: 'birthday';
        accessor: (MAPluggableAccessor
                read: [:person | person birthday ifNotNil: [person birthday yyyymmdd]]
                write: [:person :string |string ifNotNil: [person birthday: string
asDate]]);
        yourself


Le 03/03/2017 à 21:12, Hilaire a écrit :
> Not sure it is related to this:
> http://forum.world.st/Possible-bug-with-Voyage-Mongo-date-tt4735597.html

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

Sabine Manaa
Hi Hilaire,

it is interesting to see your posts and having similar topics as me when starting to use voyage.
I ended up with saving ZTimestamps. But I will think about storing strings too, because this is more readable when having direct look into mongo.
There was a discussion in slack a few days ago (February, 21st) about saving Dates in voyage.

Regards 
Sabine



2017-03-04 11:21 GMT+01:00 HilaireFernandes [via Smalltalk] <[hidden email]>:
Concerning this problem, one option I found is to get far away of the
Voyage/Mongo Date/DateAndTime representation/conversion and stick to
string, not really efficience, but well...

mongoBirthday
<mongoDescription>
^ VOToOneDescription new
        attributeName: 'birthday';
        accessor: (MAPluggableAccessor
                read: [:person | person birthday ifNotNil: [person birthday yyyymmdd]]
                write: [:person :string |string ifNotNil: [person birthday: string
asDate]]);
        yourself


Le 03/03/2017 à 21:12, Hilaire a écrit :
> Not sure it is related to this:
> http://forum.world.st/Possible-bug-with-Voyage-Mongo-date-tt4735597.html

--
Dr. Geo
http://drgeo.eu





If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Voyage-and-Date-tp4937235p4937262.html
To start a new topic under Pharo Smalltalk Users, email [hidden email]
To unsubscribe from Pharo Smalltalk Users, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

NorbertHartl
I think sticking to a date string is the safest thing to do. Especially if you use iso yyyy-mm-dd because the database indexes are predix based and are able to sort and build ranges. So you don't loose much.
The problem is regarding the conceptually incompatible offset and #asDate. #asDate just cuts off minutes hours and seconds from am DateAndTime. So if the offset has a startDate of yesterday asDate will give a date yesterday. In my code I either use "asLocal asDate" or date as string. No better solution so far

Am 04.03.2017 um 12:15 schrieb Sabine Manaa <[hidden email]>:

Hi Hilaire,

it is interesting to see your posts and having similar topics as me when starting to use voyage.
I ended up with saving ZTimestamps. But I will think about storing strings too, because this is more readable when having direct look into mongo.
There was a discussion in slack a few days ago (February, 21st) about saving Dates in voyage.

Regards 
Sabine



2017-03-04 11:21 GMT+01:00 HilaireFernandes [via Smalltalk] <[hidden email]>:
Concerning this problem, one option I found is to get far away of the
Voyage/Mongo Date/DateAndTime representation/conversion and stick to
string, not really efficience, but well...

mongoBirthday
<mongoDescription>
^ VOToOneDescription new
        attributeName: 'birthday';
        accessor: (MAPluggableAccessor
                read: [:person | person birthday ifNotNil: [person birthday yyyymmdd]]
                write: [:person :string |string ifNotNil: [person birthday: string
asDate]]);
        yourself


Le 03/03/2017 à 21:12, Hilaire a écrit :
> Not sure it is related to this:
> http://forum.world.st/Possible-bug-with-Voyage-Mongo-date-tt4735597.html

--
Dr. Geo
http://drgeo.eu





If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Voyage-and-Date-tp4937235p4937262.html
To start a new topic under Pharo Smalltalk Users, email [hidden email]
To unsubscribe from Pharo Smalltalk Users, click here.
NAML



View this message in context: Re: Voyage and Date
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

stepharong
In reply to this post by Sabine Manaa
I would love to have a digest of the problems you encountered and the solution.
Because like that we could write a better documentation.

I cannot because I do not face the problems (since I'm not developing real apps for lack of time/concentration....). 

Stef
 

On Sat, 04 Mar 2017 12:15:39 +0100, Sabine Manaa <[hidden email]> wrote:

Hi Hilaire,

it is interesting to see your posts and having similar topics as me when starting to use voyage.
I ended up with saving ZTimestamps. But I will think about storing strings too, because this is more readable when having direct look into mongo.
There was a discussion in slack a few days ago (February, 21st) about saving Dates in voyage.

Regards 
Sabine



2017-03-04 11:21 GMT+01:00 HilaireFernandes [via Smalltalk] <[hidden email]>:
Concerning this problem, one option I found is to get far away of the
Voyage/Mongo Date/DateAndTime representation/conversion and stick to
string, not really efficience, but well...

mongoBirthday
<mongoDescription>
^ VOToOneDescription new
        attributeName: 'birthday';
        accessor: (MAPluggableAccessor
                read: [:person | person birthday ifNotNil: [person birthday yyyymmdd]]
                write: [:person :string |string ifNotNil: [person birthday: string
asDate]]);
        yourself


Le 03/03/2017 à 21:12, Hilaire a écrit :
> Not sure it is related to this:
> http://forum.world.st/Possible-bug-with-Voyage-Mongo-date-tt4735597.html

--
Dr. Geo
http://drgeo.eu





If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Voyage-and-Date-tp4937235p4937262.html
To start a new topic under Pharo Smalltalk Users, email [hidden email]
To unsubscribe from Pharo Smalltalk Users, click here.
NAML



View this message in context: Re: Voyage and Date
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



--
Using Opera's mail client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

HilaireFernandes
Hi Stephan,

I am maintaining such a digest, with links to the discussion on the
list. I will post it once I am done with Voyage.

Hilaire

Le 04/03/2017 à 21:34, stepharong a écrit :
> I would love to have a digest of the problems you encountered and the
> solution.
> Because like that we could write a better documentation.
>
> I cannot because I do not face the problems (since I'm not developing
> real apps for lack of time/concentration....).
>

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

EstebanLM
In reply to this post by HilaireFernandes
yes, this is a good solution.

the base of the problem is that mongo does not actually has a Date type, just DateAndTime (even if is called Date).
So if you want a Date, you need to do some conversion.

Esteban

> On 4 Mar 2017, at 11:25, Hilaire <[hidden email]> wrote:
>
> Concerning this problem, one option I found is to get far away of the
> Voyage/Mongo Date/DateAndTime representation/conversion and stick to
> string, not really efficience, but well...
>
> mongoBirthday
> <mongoDescription>
> ^ VOToOneDescription new
> attributeName: 'birthday';
> accessor: (MAPluggableAccessor
> read: [:person | person birthday ifNotNil: [person birthday yyyymmdd]]
> write: [:person :string |string ifNotNil: [person birthday: string
> asDate]]);
> yourself
>
>
> Le 03/03/2017 à 21:12, Hilaire a écrit :
>> Not sure it is related to this:
>> http://forum.world.st/Possible-bug-with-Voyage-Mongo-date-tt4735597.html
>
> --
> Dr. Geo
> http://drgeo.eu
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

HilaireFernandes
Hi Esteban,

This is a recurring problem. May be Voyage should come with the
necessary adaptor to have the Date right. It is likely *every* Voyage
user faces the problem, and it does not fell good about the framework to
have issue on such elementary feature.

Hilaire

Le 05/03/2017 à 10:06, Esteban Lorenzano a écrit :
> the base of the problem is that mongo does not actually has a Date type, just DateAndTime (even if is called Date).
> So if you want a Date, you need to do some conversion.

--
Dr. Geo
http://drgeo.eu


Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

EstebanLM
Voyage cannot guess user intentions.
But yes we could add a helper to do the transformation easier (like a special description for dates), but you will always need to configure that by hand.

Esteban

> On 5 Mar 2017, at 10:22, Hilaire <[hidden email]> wrote:
>
> Hi Esteban,
>
> This is a recurring problem. May be Voyage should come with the
> necessary adaptor to have the Date right. It is likely *every* Voyage
> user faces the problem, and it does not fell good about the framework to
> have issue on such elementary feature.
>
> Hilaire
>
> Le 05/03/2017 à 10:06, Esteban Lorenzano a écrit :
>> the base of the problem is that mongo does not actually has a Date type, just DateAndTime (even if is called Date).
>> So if you want a Date, you need to do some conversion.
>
> --
> Dr. Geo
> http://drgeo.eu
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

stepharong
In reply to this post by HilaireFernandes
On Sun, 05 Mar 2017 09:49:02 +0100, Hilaire <[hidden email]> wrote:

> Hi Stephan,
>
> I am maintaining such a digest, with links to the discussion on the
> list. I will post it once I am done with Voyage.

super cooooooooooooooooooooooooooooooooooooooooooooooooool

>
> Hilaire
>
> Le 04/03/2017 à 21:34, stepharong a écrit :
>> I would love to have a digest of the problems you encountered and the
>> solution.
>> Because like that we could write a better documentation.
>>
>> I cannot because I do not face the problems (since I'm not developing
>> real apps for lack of time/concentration....).
>>
>


--
Using Opera's mail client: http://www.opera.com/mail/

Reply | Threaded
Open this post in threaded view
|

Re: Voyage and Date

HilaireFernandes
In reply to this post by HilaireFernandes

Hi,

Bellow a digest I compiled regarding problems met with Voyage, and its resolutions, all documented  through messages in the mailing list (hello Slat ;)

Hilaire

Le 05/03/2017 à 09:49, Hilaire a écrit :
Hi Stephan,

I am maintaining such a digest, with links to the discussion on the
list. I will post it once I am done with Voyage.

Hilaire

Voyage

Feedback on its installation and use:

  • MongoDB get installed and running easily
  • Scaled Decimal will mostly not be persisted. If you are doing arithmetic computing and exact value is needed, you will end with a too large integer error from Voyage (for the fraction den/num representing your exact value). You have no choice but to use float http://forum.world.st/Voyage-and-Scaled-decimal-tt4936625.html

-- 
Dr. Geo
http://drgeo.eu