Skip Menu |

This queue is for tickets about the Genealogy-Gedcom-Date CPAN distribution.

Report information
The Basics
Id: 110333
Status: resolved
Priority: 0/
Queue: Genealogy-Gedcom-Date

People
Owner: Nobody in particular
Requestors: NHORNE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 2.02
Fixed in: (no value)



Subject: Comparing dates
Is there a way to compare two dates, like DateTime's compare() method?
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
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 (<, ==, >)?
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 (<, ==, >)?
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
Implemented in V 2.05.