* Fix Date Fields

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
avatar
LeslieP
Diamond
Posts: 78
Joined: 03 Jan 2021 16:38
Family Historian: V7

Fix Date Fields

Post by LeslieP »

Have just found this plugin while trying to find a way to overcome the differences between RootsMagic and FH on date modifiers and qualifiers.

I have a lot of dates that are
<date>-<date>, 1917-1918
with just a single dash, no spaces, and they need to be converted to
From <date> to <date> From 1917 to 1918

At this point I don't think I need/want anything any more sophisticated than converting from "dash" to "from/to" in order to get these dates recognized.

I have found line 344 in the plugin which seems to do the job if there IS a space on either side of the dash:

Code: Select all

{ '^"(.*%d[%d/]+) ?%- ?(.*%d[%d/]+)"$'		; 'Frm %1 to %2'	}; -- Fix "Date - Date"
Not having ever seen LUA before, I'm a bit stymied on how I would copy that line and modify to handle my situation, would it be as simple as changing ") ?%- ?" to ")?%-?" Like so:

Code: Select all

{ '^"(.*%d[%d/]+)?%-?(.*%d[%d/]+)"$'		; 'Frm %1 to %2'	}; -- Fix "Date-Date"
Would that small addition to the plugin file take care of this?

Also, I'm currently prepared to fix the following in the GEDCOM, but it might be something to add to the file for other future RootsMagic people:
UNTIL <date> convert to TO <date>
SAY <date> convert to EST <date>
Leslie P
Houston, TX
from TMG to RootsMagic to FH7
publish to web via TNG
User avatar
tatewise
Megastar
Posts: 28414
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Fix Date Fields

Post by tatewise »

Leslie, have you tried running the plugin as it should fix <date>-<date>, 1917-1918. It worked for me.
In that fragment of Lua pattern you found ?%- ? the space ? means the space is optional so should match:
<date> - <date>
<date> -<date>
<date>- <date>
<date>-<date>

I've updated the plugin for UNTIL & SAY and attached Fix Date Fields prototype Version 1.2.1 Date 22 Mar 2021 for you to try.
[ Prototype deleted as Plugin Store version exists. ]
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
LeslieP
Diamond
Posts: 78
Joined: 03 Jan 2021 16:38
Family Historian: V7

Re: Fix Date Fields

Post by LeslieP »

Just tried the update, the "until" and "say" dates work great, thanks! I will probably customize it so that "say" becomes "est" rather than "circa" but that's more of a preference for my usage, no big deal, and I've now figured out how to make that change.

I have noticed small issue with the double dates. "17 JAN 1599/1600" got changed to 17 January 1599/00 which is ok, but not exactly right. Not sure it's worth the trouble to fix, just thought I'd point it out.

The range date converter does not work at all. It goes from "date-date" to date ("–date").
screenshot_20210322_002.png
screenshot_20210322_002.png (4.7 KiB) Viewed 2861 times
That first date, I manually added spaces in the GEDCOM file, the third one is exactly as it exported from RM. They do indeed get treated the same, so the space isn't the issue (as you knew, of course).

Examining the GEDCOM, these are not "keyboard hyphens", they are &ndash (dec 8211, hex 2013) characters. Does that have something to do with it?
Leslie P
Houston, TX
from TMG to RootsMagic to FH7
publish to web via TNG
User avatar
tatewise
Megastar
Posts: 28414
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Fix Date Fields

Post by tatewise »

I chose circa/about for say because it did not seem to fit the definition of estimated.

The double date format is correct for the GEDCOM specification so cannot be 'fixed'. RM is using its own format.
Try entering a double date into FH and that is what you get.

Your analysis is correct for the hyphen/dash character. Is that dash what RM always uses?
If so, I will correct the plugin.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
mjashby
Megastar
Posts: 722
Joined: 23 Oct 2004 10:45
Family Historian: V7
Location: Yorkshire

Re: Fix Date Fields

Post by mjashby »

Mike,

The list of acceptable date modifiers below comes from the 'Getting the most out of RoosMagic 7': There's a printing error in the example for "From/To"

RM also accepts Quaker calendar dates such as "10day 3month 1701"; but that's a different story.

Mervyn
RM7 Date Modifiers
RM7 Date Modifiers
Screenshot 2021-03-22 at 17.19.10.jpg (157.78 KiB) Viewed 2844 times
avatar
LeslieP
Diamond
Posts: 78
Joined: 03 Jan 2021 16:38
Family Historian: V7

Re: Fix Date Fields

Post by LeslieP »

As far as hyphen vs. en dash, I'm not sure if that's the way RM always does it, this is the first time I've looked at GEDCOM closely enough to figure out what the heck is going on. I'm using v7, will test it out with RM v8 later today, on the off chance they're changing things.

Interesting that when I edited the GEDCOM to change one of the en dashes to a hyphen, the regular FH import converted it to the from/to format without any intervention.
Leslie P
Houston, TX
from TMG to RootsMagic to FH7
publish to web via TNG
avatar
LeslieP
Diamond
Posts: 78
Joined: 03 Jan 2021 16:38
Family Historian: V7

Re: Fix Date Fields

Post by LeslieP »

Just did a quick check - RM8 does still use the en dash for from/to dates. I wonder if other packages might use an em dash just to be weird - perhaps the plugin should handle both of those possibilities.

Given all of the modifiers that RM allows, and other packages may have even more it gets out of control pretty quickly. I kind of think that the default plugin converting most to circa or whatever seems most appropriate make sense, and then for folks like me who used "say" in a context where "est" is more appropriate, I just edit the plugin file myself and carry on.
Leslie P
Houston, TX
from TMG to RootsMagic to FH7
publish to web via TNG
User avatar
tatewise
Megastar
Posts: 28414
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Fix Date Fields

Post by tatewise »

Thank you for the feedback.
FH has got better at auto-converting Date formats in later versions, but note that the plugin caters for FH V5, V6 & V7.
I have added both en dash & em dash and all the RM qualifiers with 'say' converted to 'est' and others such as 'Certainly' thru 'Maybe' converting to an interpreted date phrase such as 'date ("certainly")' thru 'date ("maybe")'.

Try attached Fix Date Fields prototype Version 1.2.2 Date 22 Mar 2021.
[ Prototype deleted as Plugin Store version exists. ]
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
LeslieP
Diamond
Posts: 78
Joined: 03 Jan 2021 16:38
Family Historian: V7

Re: Fix Date Fields

Post by LeslieP »

BEAUTIFUL!
Fresh export from RM, new project, Find Date Phrases finds 299 items. Run the new version of Fix Date Fields and the 299 items it fixed were fixed perfectly!
Thank you so much!
Leslie P
Houston, TX
from TMG to RootsMagic to FH7
publish to web via TNG
User avatar
tatewise
Megastar
Posts: 28414
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Fix Date Fields

Post by tatewise »

The Fix Date Fields plugin Version 1.3 Date 25 Mar 2021 has been published in the Plugin Store with the RM updates plus a few other minor enhancements, so the earlier attached prototypes have been deleted.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Post Reply