Date-Cmp
view release on metacpan or search on metacpan
# DESCRIPTION
`Date::Cmp` provides a single exported function, `datecmp`, which compares
two date strings or date-like objects, returning a numeric result like Perl's
`<=>` operator.
The comparison handles approximate dates (`Abt. 1902`, `BET 1830 AND 1832`,
`Oct/Nov/Dec 1950`), partial dates (year-only), and the common genealogy
qualifiers `BEF` and `AFT`. Exact parsing delegates to
[DateTime::Format::Genealogy](https://metacpan.org/pod/DateTime%3A%3AFormat%3A%3AGenealogy); a cascade of fast-path heuristics handles
the most common year-only comparisons without invoking the heavier parser.
# FUNCTIONS
## datecmp
### Purpose
Compare two genealogy-style date strings (or date-like objects) and return
a value equivalent to Perl's spaceship operator (`<=>`): `-1` if the
lib/Date/Cmp.pm view on Meta::CPAN
=head1 DESCRIPTION
C<Date::Cmp> provides a single exported function, C<datecmp>, which compares
two date strings or date-like objects, returning a numeric result like Perl's
C<< <=> >> operator.
The comparison handles approximate dates (C<Abt. 1902>, C<BET 1830 AND 1832>,
C<Oct/Nov/Dec 1950>), partial dates (year-only), and the common genealogy
qualifiers C<BEF> and C<AFT>. Exact parsing delegates to
L<DateTime::Format::Genealogy>; a cascade of fast-path heuristics handles
the most common year-only comparisons without invoking the heavier parser.
=head1 FUNCTIONS
=head2 datecmp
=head3 Purpose
Compare two genealogy-style date strings (or date-like objects) and return
a value equivalent to Perl's spaceship operator (C<< <=> >>): C<-1> if the
( run in 1.618 second using v1.01-cache-2.11-cpan-e7c6538aa59 )