Issues with SDN values

23 views
Skip to first unread message

Richard Blake

unread,
May 30, 2026, 4:49:04 AM (12 days ago) May 30
to GEDitCOM II Discussions
Hi

I have been playing around with dates in a script and have found a couple of things that don't look right to me when calculating SDN values.

First, the calculation for maximum value when the date is just a year. The following script snippet shows that the end date is 30th Dec and not 31st Dec.

SDNRange "#var", "1872"
DateText "#start", #var[1]
DateText "#end", #var[2]
Write #var[1]&" "&#start&return
Write #var[2]&" "&#end&return

Output:

2404794 1 JAN 1872

2405158 30 DEC 1872



The other item may be as designed but just the way I think about it. I have a number of dates that are open ended. For example 'FROM 1872' other 'TO 1872'. They are b both valid GEDCOM for when only one end of a date range is know. In the first of these, I think the max value should be the largest possible and in the second, the min value should be 1. Whereas they are both calculated as if the date just said '1872'. Does that make sense.


SDNRange "#var", "FROM 1872"
DateText "#start", #var[1]
DateText "#end", #var[2]
Write #var[1]&" "&#start&return
Write #var[2]&" "&#end&return

SDNRange "#var", "TO 1872"
DateText "#start", #var[1]
DateText "#end", #var[2]
Write #var[1]&" "&#start&return
Write #var[2]&" "&#end&return


Output:

2404794 1 JAN 1872

2405158 30 DEC 1872

2404794 1 JAN 1872

2405158 30 DEC 1872


Regards


Richard

John Nairn

unread,
Jun 1, 2026, 7:16:20 PM (10 days ago) Jun 1
to geditcom-ii-discussions@googlegroups.com geditcom-ii-discussions@googlegroups.com
“Fuzzy” dates can be a bit tricky, but goal is to be consistent. First, calendar dates and day numbers can be off by 1 or 2 days due to various numbers of days in a month, days in a year, or use of different calendars. You first example got Jan 1 for minimum and Dec 30 for maximum. Only the second is off by 1 day and likely to due SDN code methods. It is pretty close.

A date “FROM 1872” is treated like 1872. Perhaps SDN max could be infinite (all days after some day in 1872, but that result is normally not useful). The general calculation is

1 A single data, take first day possible as minimum and last day possible as maximum

2. Double data (like FROM 1872 TO 1880 or BET 1872 AND 1880) finds minimum from Jan 1 1872 (+/1 a day) and maximum from Dec 31 1880 (+/- day)

If a script wants to treat “FROM” and “TO” differently, you can use the “Date Parts” command and look for those keywords. My thinking was that finding very large SDN max for “FROM” date (or very small SDN min for “TO” datw) would be unlikely to be a useful number. I suppose a burial date code as FROM some day does extend for all time, but genealogists usually document burials with the actual burial date and not an internment date range. “FROM” is more common for things like occupations or residences. Here open ended usually means you don’t now the end date and not that it should go on forever.

But, as long as you know what SDN min and max are doing, you can alter with “Date Parts” if accounting for “FROM” or “TO” matters.

Hope that helps.

John Nairn

--
You received this message because you are subscribed to the Google Groups "GEDitCOM II Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geditcom-ii-discu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/geditcom-ii-discussions/04f305f3-b41b-4e23-81bf-ba03415d3ea3n%40googlegroups.com.

John Nairn, Developer

unread,
Jun 1, 2026, 9:14:08 PM (10 days ago) Jun 1
to GEDitCOM II Discussions
I had another look for an improvement. I was able to insert a special case for dates that are just an year and to handle all calendars too. It will be in the next version. Now SDN min and SDN max should get exact dates atd beginning and end of the year. Here is internal script and output (although this output will require next version of the code). Note that "DateText converts SDN to Gregorian (maybe I should add option for other calendars). To check Hebrew and French Republic calendars, I pasted output into DateCalculator and they look right.

Sub MinMax,#date
  Write "Date: "&#date&return
  SDNRange "#var",#date

  DateText "#start", #var[1]
  Write "  min SDN = "&#var[1]&" or "&#start&return

  DateText "#end", #var[2]
  Write "  max SDN = "&#var[2]&" or "&#end&return
EndSub

GoSub MinMax,"1872"
GoSub MinMax,"FROM 1872"
GoSub MinMax,"FROM 1872 TO 1873"
GoSub MinMax,"@#DHEBREW@ 5632"
GoSub MinMax,"@#DFRENCH R@ 10"

Output is

Date: 1872
  min SDN = 2404794 or 1 JAN 1872
  max SDN = 2405159 or 31 DEC 1872
Date: FROM 1872
  min SDN = 2404794 or 1 JAN 1872
  max SDN = 2405159 or 31 DEC 1872
Date: FROM 1872 TO 1873
  min SDN = 2404794 or 1 JAN 1872
  max SDN = 2405524 or 31 DEC 1873
Date: @#DHEBREW@ 5632
  min SDN = 2404687 or 16 SEP 1871  (i.e. 1 TSH 5632)
  max SDN = 2405069 or 2 OCT 1872   (i.e. 29 ELL 5632)
Date: @#DFRENCH R@ 10
  min SDN = 2379127 or 23 SEP 1801  (i.e 1 VEND 0010)
  max SDN = 2379491 or 22 SEP 1802  (i.e. 5 COMP 0010)

John Nairn
Reply all
Reply to author
Forward
0 new messages