gap icon indicating copy to clipboard operation
gap copied to clipboard

BibEntry assumes package dates are in "dd/mm/yyyy" format

Open stertooy opened this issue 1 year ago • 0 comments

In the following piece of code, the BibEntry function assumes the Date field of a package info record is in the "dd/mm/yyyy"-format (or dd@mm@yyyy with any choice of separator @ really).

https://github.com/gap-system/gap/blob/0d29d4b9736a04534f0c0701bd2a42da5bf214a1/lib/package.gi#L2936-L2948

However, I think the current recommendation is for dates to be in the "yyyy-mm-dd" format. This causes trouble for GitHubPagesForGAP, which relies on BibEntry to get its information for citing a package - see e.g. the GitHub page for the Example package, which has:

[NGK20]
Nickel, W., Gamble, G. and Konovalov, O.,
Example,
Example/Template of a GAP Package,
Version 4.4.0 (1-20) (GAP package),
https://gap-packages.github.io/example.

Here, the citekey should be NGK24 and the year should be 2024, of course. The mistakes stem from BibEntry assuming that the last 4 characters of the string 2024-11-20 represent the year. By contrast, in the same function, the date of GAP itself is assumed to be in the "yyyy-mm-dd"-format:

https://github.com/gap-system/gap/blob/0d29d4b9736a04534f0c0701bd2a42da5bf214a1/lib/package.gi#L2880-L2891

What may complicate things, is that when GAP reads package metadata on startup, it seems to automatically convert dates to "dd/mm/year"-format before storing it in GAPInfo.PackagesInfo, whereas no such conversion happens when calling GAPInfo.PackageInfoCurrent. If I am working in Example's base directory:

[...]/example$ echo "Print(GAPInfo.PackagesInfo.example[1].Date,\"\n\");QuitGap();" | gap -A -q 
20/11/2024
[...]/example$ echo "Read(\"PackageInfo.g\");Print(GAPInfo.PackageInfoCurrent.Date,\"\n\");QuitGap();" | gap -A -q 
2024-11-20

stertooy avatar Nov 29 '24 16:11 stertooy