* Does not display date in ABBREV3 format

Questions about creating, customising and using diagrams and charts
Post Reply
avatar
Cijunas
Silver
Posts: 8
Joined: 19 Jun 2023 06:32
Family Historian: V7

Does not display date in ABBREV3 format

Post by Cijunas »

Hi,
I use my individual Lithuanian language pack in diagrams. But I can't change the dates into ABBREV3 format. It always shown as LONG.
For example I changed CTA to 3SA:
=FactText(%INDI.BIRT[1+]%,"3SA","E_Born: _ in _")
but the result is the same: Born: 1852 m. sausio 23 d. (in English: 23 January 1852)
The same situation is using German or French diagram languages.
What should I do to display the date in the diagrams as 1852-01-23?
User avatar
tatewise
Megastar
Posts: 28488
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Does not display date in ABBREV3 format

Post by tatewise »

Welcome to the FHUG.

The translation of Dates is handled by the Language Pack Plugin in its FH_GetDateText function.

You have already modified the Plugin for the Lithuanian language but the Plugin template supplied by Calico Pie does not handle Date qualifiers/formats and only produces standard Date format. So you must modify the Plugin further to cater for the Date formats you require.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Mark1834
Megastar
Posts: 2535
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Does not display date in ABBREV3 format

Post by Mark1834 »

Be aware that AFAIK there is no easy way to make FH display dates in that yyyy-mm-dd ISO form unless it is already defined as your Windows format. You have to create a very convoluted function to assemble the various parts and keep leading zeros.

IMO, that is a significant shortcoming, as it is the only numeric date format that is globally unambiguous.
Mark Draper
avatar
Cijunas
Silver
Posts: 8
Joined: 19 Jun 2023 06:32
Family Historian: V7

Re: Does not display date in ABBREV3 format

Post by Cijunas »

Thank you, I understand now.
Can I copy a whole text of FH_GetDateText function from English (ENG) Calico Pie V1.1 Language Pack Plugin and modify it? Because the text is different in my Plugin (and in other languages of Calico Pie Language Packs).
Or there is more complex situation?
avatar
Cijunas
Silver
Posts: 8
Joined: 19 Jun 2023 06:32
Family Historian: V7

Re: Does not display date in ABBREV3 format

Post by Cijunas »

Mark1834 wrote: 19 Jun 2023 10:15 Be aware that AFAIK there is no easy way to make FH display dates in that yyyy-mm-dd ISO form unless it is already defined as your Windows format. You have to create a very convoluted function to assemble the various parts and keep leading zeros.
Thank you. My Windows system format is 2023-06-19. I usually use two types of dates in FH. One exact (I want that format for this type) and all other dates can be as is (with months names, phrases etc.).
User avatar
tatewise
Megastar
Posts: 28488
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Does not display date in ABBREV3 format

Post by tatewise »

I don't think Mark is entirely correct about the yyyy-mm-dd format.
Tools > Preferences > General > Preferred Short Date Format: yyyy-mm-dd is used when ABBREV3 format is chosen.
The snag is that it omits leading zeros in the month and day components so 1st Jan 1900 is 1900-1-1 which does not sort correctly with other dates when rendered as plain text. However, in Diagrams that is not a problem.

Further date formatting discussions continue in FH Short Date and ISO Format (22013).

Yes, the English Language Pack seems to cater for Date Qualifiers such as ABBREV3 so you should be able to use that in conjunction with your Lithuanian translations which are needed for other Date Qualifiers or no qualifiers.

You will need to use components from the FH_GetDateText function that handle ABBREVn formats and add functions such as GetDatePeriodOrRangeAbbrev.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
Cijunas
Silver
Posts: 8
Joined: 19 Jun 2023 06:32
Family Historian: V7

Re: FH Short Date and ISO Format

Post by Cijunas »

For example in Lithuania we use ISO standard, so we always know what means 2023-01-02 (yyyy-mm-dd).
Thank you for the discussion.
I hope the several lines in my Plugin will help to translate FH date format into ISO date format.
For example:
if iDay >= 1 and iDay <= 9 then
sDay = '0' .. iDay;
else
sDay = iDay;
end
if iMonth >= 1 and iMonth <= 9 then
sMonth = '0' .. iMonth;
else
sMonth = iMonth;
end
Let me know please, if I am on wrong way.
User avatar
tatewise
Megastar
Posts: 28488
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Does not display date in ABBREV3 format

Post by tatewise »

Yes, that looks like the correct approach.
If when you test it you have any problems then post here again.

On closer inspection, the following would be better to cope with no Day or no Month in Date:
if iDay >= 1 and iDay <= 9 then
sDay = '0' .. iDay;
elseif iDay > 9 then
sDay = iDay;
end
if iMonth >= 1 and iMonth <= 9 then
sMonth = '0' .. iMonth;
elseif iMonth > 9 then
sMonth = iMonth;
end
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28488
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Does not display date in ABBREV3 format

Post by tatewise »

You may be interested in the Language Pack English (ENG RPRT) Mike Tate that I have just published in the Plugin Store.
It has existed as an attachment to Language Pack can alter English Report labels (19841) for some time but I have updated it to cater for most Date Formats in both Reports and Diagrams.

It handles Format Qualifiers on Date fields, Report and Diagram Options settings for Date Format, the FactText(...) function Date Format options, and the Tools > Preferences > General tab settings for Preferred Standard/Short Date Format.

So if a Date has the ABBREV3 Qualifier or the Date Format is set to Abbreviated (3), and the Preferred Short Date Format is set to yyyy-mm-dd, then the ISO Date Format is produced with leading zeros where necessary.

That is all handled in the Plugin script where the Date functions are derived from the English (ENG) Calico Pie Language Pack and modified to handle extra format options:
On Line 14:
require "luacom";
About Line 55:
g_date_stand_form = "ddmmmyyyy";
g_date_short_form = "dd/mm/yyyy";
g_date_short_sep = "/"

Changes and additions:
function FH_LangPackBegin(...)
function GetRegKey(strKey)
function GetDatePtText(...)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
Gary_G
Megastar
Posts: 758
Joined: 24 Mar 2023 19:05
Family Historian: V7

Re: Does not display date in ABBREV3 format

Post by Gary_G »

Mike;

In order to get FH to use a format like "27 Feb 2024", is doing a language pack modification the route to go?
Gary Gauthier
Hunting History in the Wild!
User avatar
tatewise
Megastar
Posts: 28488
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Does not display date in ABBREV3 format

Post by tatewise »

Gary_G wrote: 03 Mar 2024 22:48 In order to get FH to use a format like "27 Feb 2024", is doing a language pack modification the route to go?
No Gary, you can set the Date Format in the Diagram Text Scheme options.
See the Diagram > Options > Text tab, Edit Text Scheme... button, Date Format: option near the top.
Some options depend on Tools > Preferences > General tab Preferred Standard/Short Date Format settings.
See the FH Help on General Topics > Date Formats for details.

This thread is discussing the intricacies of translating Date Formats with Language Packs but if everything is in English they do not apply.

BTW: The default Text Scheme setting is Date Format: Compact which produces 27 Feb 2024 as in your question.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
Gary_G
Megastar
Posts: 758
Joined: 24 Mar 2023 19:05
Family Historian: V7

Re: Does not display date in ABBREV3 format

Post by Gary_G »

Thank you, Mike. I saw your other answer and will try that.
Gary Gauthier
Hunting History in the Wild!
Post Reply