Neriderc / GVExport

Repository for GVExport module for Webtrees
GNU General Public License v2.0
15 stars 6 forks source link

Add option to abbreviate dates #471

Closed Neriderc closed 8 months ago

Neriderc commented 8 months ago

To shorten the width of the diagram, all dates (Birth, Death, Marriage) may get the additional option "compact date", which uses only the first three characters of the month. For example: 12. Nov. 2024 instead of 12. November 2024

Originally posted by @marwelin in https://github.com/Neriderc/GVExport/issues/232#issuecomment-2008745518

Neriderc commented 8 months ago

We could also consider other date formats, such as 1/2/2024, though different areas order this differently so we should investigate adding a custom format of some sort where you can type a date format to use.

hartenthaler commented 8 months ago

When I remember right the date format used depends by default on the language setting of the user. There should be no interference with that. It would be nice to show only 3 letters of the month, but those letters should be the translated names (for me "Dez." (German) and not "Dec." (English). And it makes no sense to write "Mär." instead of "März" (for the month "March", ie. don't shorten names that are 4 letters or less long.

Neriderc commented 8 months ago

In English, it would be odd to not shorten June which is 4 letters. You'd either do March, April, May, June or Mar, Apr, May, Jun.

I notice that webtrees already has functionality that shortens the month in dates. It has a small number of special cases, but German does not appear to be treated differently. Is there any reason not to use the webtrees month shortening?

screen shot of code IDE showing the monthNameAbbreviated function and cases for French dates, Hijri dates, Jalali dates, Jewish dates, and the standard Gregorian date case

hartenthaler commented 8 months ago

If there is a already month shortening in webtrees established it can be used.

Neriderc commented 8 months ago

In terms of custom dates (which was my suggestion), this is probably not possible. Dates are not all standard, but include all sorts of custom cases. We don't always know all parts of the date, the dates can be a range, and it's unlikely we can resolve this in a way that a user can customise the date. For example, the date of birth might be "Between 6 Jan 1900 and Nov 1902". We handle this ok, but it makes custom date formats impractical.

For this one I have added a checkbox to the Abbreviations section to abbreviate month names. I am still working on the help text as I need to refactor the page but I expect to have this done soon (in the next day or so).

Neriderc commented 8 months ago

This is done and merged in, will be in a release soon.