NAME
Gedcom::Date - Perl class for interpreting dates in Gedcom files
SYNOPSIS
use Gedcom::Date;
my $date = Gedcom::Date->parse( 'ABT 10 JUL 2003' );
my $dt = DateTime->now;
my $date2 = Gedcom::Date->from_datetime( $dt );
$date->gedcom; # 'ABT 10 JUL 2003'
$date->as_text; # 'about 10 July 2003'
$date->as_text('nl'); # 'rond 10 juli 2003' (nl = Dutch language)
DESCRIPTION
The Gedcom standard for genealogical data files defines a number of date formats. This module can parse most of these formats.
This package contains a number of modules, each implementing a Gedcom date format. They are:
Gedcom::Date::Simple
e.g. "4 JUN 1729", "JUL 2003", "1974"
Gedcom::Date::Approximated
e.g. "ABT 15 JUN 1672", "CAL 1922", "EST 1700"
Gedcom::Date::Interpreted
e.g. "INT 12 APR 1657 (Easter Monday)"
Gedcom::Date::Period
e.g. "FROM 1522 TO 1534", "FROM 30 APR 1980", "TO 1910"
Gedcom::Date::Range
e.g. "BET 1600 AND 1620", "AFTER 1948", "BEF 2 AUG 2003"
Gedcom::Date::Phrase
e.g. "(Once upon a time)"
METHODS
Class methods
parse( $date )
Creates a Gedcom::Date object from a string. The string should be a valid date value according to the Gedcom standard v5.5.
from_datetime( $datetime_object )
Creates a Gedcom::Date object from a DateTime object. The return value is a Gedcom::Date::Simple object.
DefaultLocale( $locale )
If called with one argument, sets the default locale used in output routines. If called without arguments, returns the current default locale.
Instance methods
earliest
Returns the earliest possible date; e.g. for the date "BET 10 JUL 2003 AND 20 JUL 2003" it returns July 10, 2003. The value returned is a DateTime object.
latest
Returns the latest possible date; e.g. for the date "BET 10 JUL 2003 AND 20 JUL 2003" it returns July 20, 2003. The value returned is a DateTime object.
gedcom
Returns the date in Gedcom format.
as_text( $locale )
Returns the date in a format that can be included in a narrative text. You can set the language of the text by passing an optional locale argument. This should be a DateTime::Locale object, or a valid locale identifier. The default locale is 'en_GB' by default, but can be set with the DefaultLocale method.
AUTHOR
Eugene van der Pijll <pijll@gmx.net>
COPYRIGHT
Copyright (c) 2003 Eugene van der Pijll. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
perl(1).