Mon Dec 14 12:32:18 2015NHORNE [...] cpan.org - Ticket created
Subject:
Comparing dates
Is there a way to compare two dates, like DateTime's compare() method?
Mon Dec 14 17:03:13 2015ron [...] savage.net.au - Correspondence added
Subject:
Re: [rt.cpan.org #110333] Comparing dates
Date:
Tue, 15 Dec 2015 09:02:53 +1100
To:
bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From:
Ron Savage <ron [...] savage.net.au>
Hi Nigel
On 15/12/15 04:32, Nigel Horne via RT wrote:
Show quoted text
> Mon Dec 14 12:32:18 2015: Request 110333 was acted upon.
> Is there a way to compare two dates, like DateTime's compare() method?
I did not plan anything about this, but I've made a note to look into it.
--
Ron Savage - savage.net.au
Mon Dec 14 17:03:13 2015The RT System itself - Status changed from 'new' to 'open'
Sun Dec 20 16:00:15 2015RSAVAGE [...] cpan.org - Correspondence added
I've had a look at this, and I think the code needs to:
o Save the result of unambiguous parses (i.e. the canonical value) in a cache. Date ranges which are unambiguous won't be saved.
o Overload 'cmp'. I've never used overload but it seems straightforward.
o Declare a compare() method for cmp to call.
o This allows the user to do:
$date_1 = G::G::D->new(...)
$date_2 = G::G::D->new(...)
if ($date_1 cmp $date_2){...}
I'll revisit this during the next few days.
But, what should cmp return? 2 values (== 'v' !=) or 3 (<, ==, >)?
Sun Dec 20 18:56:38 2015NHORNE [...] cpan.org - Correspondence added
Thanks, this will help with sorting citations in date order in gedcal. I suggest returning a <=> compatible value, thus:
date 1 < date 2 => return < 0
date 1 == date 2 => return 0
date 1 > date 2 => return > 0
Show quoted text
> But, what should cmp return? 2 values (== 'v' !=) or 3 (<, ==, >)?
Sun Jan 10 00:59:49 2016ron [...] savage.net.au - Correspondence added
Subject:
Re: [rt.cpan.org #110333] Comparing dates
Date:
Sun, 10 Jan 2016 16:59:28 +1100
To:
bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From:
Ron Savage <ron [...] savage.net.au>
Hi Nigel
I released V 2.05 implementing compare($other_object). It returns a
value in the range 0 .. 3 (sic).
On 21/12/15 10:56, Nigel Horne via RT wrote:
Show quoted text
> Queue: Genealogy-Gedcom-Date
> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=110333 >
>
> Thanks, this will help with sorting citations in date order in gedcal. I suggest returning a <=> compatible value, thus:
>
> date 1 < date 2 => return < 0
> date 1 == date 2 => return 0
> date 1 > date 2 => return > 0
>> But, what should cmp return? 2 values (== 'v' !=) or 3 (<, ==, >)?
>
>
>
--
Ron Savage - savage.net.au
Mon Feb 15 16:35:25 2016RSAVAGE [...] cpan.org - Correspondence added
Implemented in V 2.05.
Mon Feb 15 16:35:27 2016RSAVAGE [...] cpan.org - Status changed from 'open' to 'resolved'