Skip to content

Commit

Permalink
Handle "about Feb 1877"
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Sep 20, 2024
1 parent e5b686f commit 485e371
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -12371,17 +12371,9 @@ sub dateofdeath
# Dig the date out of a field and return in a valid gedcom format
sub parse_date
{
my %params;

if(ref($_[0]) eq 'HASH') {
%params = %{$_[0]};
} elsif(scalar(@_) % 2 == 0) {
%params = @_;
} else {
$params{'date'} = shift;
}
my $params = get_params('date', @_);

if(my $date = $params{'date'}) {
if(my $date = $params->{'date'}) {
if(ref($date)) {
# Caused by empty value, e.g.:
# 1 BIRT
Expand All @@ -12400,8 +12392,8 @@ sub parse_date
return;
}

my $type = $params{'type'};
my $person = $params{'person'};
my $type = $params->{'type'};
my $person = $params->{'person'};
my $after;
my $before;
my $about;
Expand Down Expand Up @@ -12438,6 +12430,10 @@ sub parse_date
if($date =~ /^(\d+)\-00\-00$/) {
$date = $1
}
} elsif($date =~ /^about\s?([A-Z]{3})\s(\d{3,4})/i) {
# about Feb 1877
$date = "$1 $2";
$about = 1;
}

if($date =~ /[A-Z]{4,}/i) {
Expand Down Expand Up @@ -12478,7 +12474,7 @@ sub parse_date
while((my @call_details = caller($i++))) {
print STDERR "\t", colored($call_details[2] . ' of ' . $call_details[1], 'red'), "\n";
}
die 'BUG: parse_date(): handle "', $params{'date'}, '" on ', $person->as_string();
die 'BUG: parse_date(): handle "', $params->{'date'}, '" on ', $person->as_string();
}
if($about) {
$date = "abt $date";
Expand Down

0 comments on commit 485e371

Please sign in to comment.