Skip to content

Commit

Permalink
Merge pull request #61 from albarin/allow-year-month-dates
Browse files Browse the repository at this point in the history
Allow dates with the `YYYY-MM` format
  • Loading branch information
curtisdelicata authored Aug 25, 2024
2 parents 62d09e6 + 177f13e commit 2acf76f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Parser/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public static function parse(\Gedcom\Parser $parser)
return $dat->getYear().'-'.substr("0{$dat->getMonth()}", -2).'-'.substr("0{$dat->getDay()}", -2);
}

if ($dat->getYear() && $dat->getMonth()) {
return $dat->getYear().'-'.substr("0{$dat->getMonth()}", -2);
}

return $dat->getYear();
}
}

0 comments on commit 2acf76f

Please sign in to comment.