Code: Select all
<{Date:YEAR}{=TextIf(%SOUR.~DT-DATE:MONTH_NUMBER% <= 9,"-0","-")}{%SOUR.~DT-DATE:MONTH_NUMBER%}{=TextIf(%SOUR.~DT-DATE:DAY% <= 9,"-0","-")}{%SOUR.~DT-DATE:DAY%}>
eg.
5 Apr 1891 ==> 1891-04-05 [correct]
Apr 1891 ==> 1891-04-0 [incorrect]
1891 ==> 1891-0-0 [incorrect]
[empty] ==> -- [incorrect]
As FH7 does some validation of the {Date} field, erroneous combinations are typically precluded.
In situations in which the day, month or year is not specified, one would expect the position to be filled by zeroes.
eg.
5 Apr 1891 ==> 1891-04-05 [correct]
Apr 1891 ==> 1891-04-00 [correct]
1891. ==> 1891-00-00 [correct]
[empty] ==> 0000-00-00 [correct]
I've tried various ways to get this code to yield the correct results, but have not had any luck.
Can someone suggest the needed changes?