curationexperts / cypripedium

A Hyrax 3 application for the Federal Reserve Bank of Minneapolis
2 stars 3 forks source link

Enhance date handling in citations #580

Closed mark-dce closed 7 months ago

mark-dce commented 7 months ago

This commit adds support for including months or seasons in publication dates, e.g.

[created]   --> [displays]
2021-01-12  --> January 2021
2019 Winter --> Winter 2019
1968        --> 1968

We've also added a fallback to use the date_uploaded year if there is no date_created value present for a particular item.

If neither date_created nor date_uploaded are present, the publication year is listed as "no date" in citations. date_uploaded should always be present in production, but handling this case makes test setup simpler and makes some tests less fragile.

NOTES: The CSL parser attempts to format the issued element as a numeric date, so "Winter 2019" and "January 2021" both raise an exception. Instead, we can use the status element which diplays in the same positon in the citation, but renders the text provided without attempting any date parsing.