Re: timelines from GEDCOM files
[email protected] ("Stephen Pickles") Wed, 13 Aug 2008 20:02:31 +0100
| Newsgroups | perl.gedcom |
|---|---|
| Message-ID | <[email protected]> |
Hi Philip, I'm slightly puzzled by your comment about dates of the form "Feb 1978". I encountered a different problem with this kind of date back in January, when I wrote a script that generates an icalendar file from birth, marriage and death events in a GEDCOM file. My test files had several dates like "Feb 1978". The ParseDate routine in Date::Manip handles "Feb 1978" as if it were "1 Feb 1978". Similarly, ParseDate returns the same result for "1960", "Jan 1960" and "1 Jan 1960". This behaviour suited the author's purposes and was intentional. But it's not always what you want in a genealogical application. If you're not careful, you'll end up adding spurious information (e.g. a day of month when none is known). But does it actually matter for your timeline application? It did matter for my application, and I ended up abandoning Date::Manip and writing my own date parser. As I was only interested in exact dates, I could safely skip variants like "Feb 1978", "BEF 17 FEB 1978", "AFT 1977" and so on. Hence I don't claim to have a generic GEDCOM date parser. BTW, anyone using the normalise_dates routine in Paul Johnson's Gedcom module should beware, for it will normalise "Feb 1978" as if it were "1 Feb 1978". Once again, it's the ParseDate routine in Date::Manip that's responsible for the insertion of the spurious day of month. (Dates containing just the year happen to be safe, because they get trapped by some defensive code in Paul's Gedcom module.) I'd like to say "hope this helps", but it probably doesn't. Stephen > > 5. Help me figure out how to avoid my "James Riley Durbin death date hack" > that has been crystallized in line 117 of Timeline.pm. The problem is that > dates such as "Feb 1978" are parseable by Date::Manip::ParseDate but not > Simile Timeline. (Perhaps this should be fixed in Simile Timeline!) > Basically, the hack extracts the year (i.e. 1978) so that Simile Timeline > can at least display that. I guess I need to add some logic to enforce that > dates can't have only a month and year. I wonder how many different dates > formats are commonly encountered in GEDCOM files. . . >