Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDTF level 2 unspecified digit pattern displays nonsensical #1756

Open
kspurgin opened this issue Feb 5, 2021 · 4 comments
Open

EDTF level 2 unspecified digit pattern displays nonsensical #1756

kspurgin opened this issue Feb 5, 2021 · 4 comments
Labels
Subject: Dates related to managing dates in Islandora. Consider also using the search and metadata tags.

Comments

@kspurgin
Copy link
Contributor

kspurgin commented Feb 5, 2021

Currently:

156X-12-25 -> unspecified year in December 25, 1560
15XX-12-25 -> unspecified decade in December 25, 1500
XXXX-12-XX -> unspecified year and day in December , 0000
1XXX-XX -> unspecified century and month in 1000
1XXX-12 -> unspecified century in December , 1000

Possible improvements:

156X-12-25 -> December 25 of unspecified year in range 1560 to 1569
15XX-12-25 -> December 25 of unspecified year in range 1500 to 1599
XXXX-12-XX -> December of unspecified year
1XXX-XX -> Unspecified month of unspecified year in range 1000 to 1999
1XXX-12 -> December of unspecified year in range 1000 to 1999

@kspurgin
Copy link
Contributor Author

kspurgin commented Feb 5, 2021

meta-issue: #1748

@seth-shaw-unlv
Copy link
Contributor

seth-shaw-unlv commented Jun 21, 2021

Looking at this again, depending on how you setup the formatter settings, anything we do here would be nonsensical. These examples rely on the formatting to be middle-endian with the full month displayed. However, the default resembles the ISO format (big-endian with hyphen separators), which results in results like:

unspecified year in 1560-12-25
unspecified decade in 1500-12-25
unspecified year and day in 0000-12
unspecified century and month in 1000
unspecified century in 1000-12

I started working on the suggested improvements, but with the default settings, they don't look much better:

unspecified year in range 1560 to 1569-12-25
unspecified year in range 1500 to 1599-12-25
unspecified day in unspecified year-12
unspecified month in unspecified year in range 1000 to 1999
unspecified year in range 1000 to 1999-12

So, I'm not sure what would make sense with these varying configuration options.

@seth-shaw-unlv
Copy link
Contributor

seth-shaw-unlv commented Jun 22, 2021

I thought I would also check how the Professional-Wiki EDTF library would handle this:

>>> $parser = \EDTF\EdtfFactory::newParser();
=> EDTF\PackagePrivate\SaneParser {#4667}
>>> $humanizer = \EDTF\EdtfFactory::newHumanizerForLanguage( 'en' );
=> EDTF\PackagePrivate\Humanizer\InternationalizedHumanizer {#1716}
>>>
>>> $humanizer->humanize($parser->parse('156X-12-25')->getEdtfValue());
=> "December 25th, 1560s"
>>> $humanizer->humanize($parser->parse('15XX-12-25')->getEdtfValue());
=> "December 25th, 1500s"
>>> $humanizer->humanize($parser->parse('XXXX-12-XX')->getEdtfValue());
=> "December"
>>> $humanizer->humanize($parser->parse('1XXX-XX')->getEdtfValue());
=> "1000"
>>> $humanizer->humanize($parser->parse('1XXX-12')->getEdtfValue());
=> "December 1000"

Using their humanizer would improve internationalization (as we could instantiate the humanizer for the currently enabled language) while losing all configurability; but at least we could shift finger pointing to them. 😉

@kspurgin
Copy link
Contributor Author

>>> $humanizer->humanize($parser->parse('156X-12-25')->getEdtfValue());
=> "December 25th, 1560s"
>>> $humanizer->humanize($parser->parse('15XX-12-25')->getEdtfValue());
=> "December 25th, 1500s"
>>> $humanizer->humanize($parser->parse('XXXX-12-XX')->getEdtfValue());
=> "December"

The above are better than what it's currently doing, for sure.

>>> $humanizer->humanize($parser->parse('1XXX-XX')->getEdtfValue());
=> "1000"
>>> $humanizer->humanize($parser->parse('1XXX-12')->getEdtfValue());
=> "December 1000"

I guess they decided that two zeros (century) was the limit for handling with 's. Well, they are not worse than what we have now.

I was not around for discussions of needs/use cases around all the flexible configurability of the EDTF field, so not sure what to say about that tradeoff.

If we were handling it in the current EDTF field, I was imagining the algorithm would have to go something like the following for 156X-12-25 -> December 25 of unspecified year in range 1560 to 1569:

  • augh this value has X's in it, I have to do a special thing which will maybe override more normal display settings
  • year part has X(s) so I turn it into a range for display (unspecified year in range 1560 to 1569)
  • I have month and day without X(s) so I will turn that into (December 25 or 25 Dec or whatever I'd do with those based on display settings)
  • Concatenate the known part with the range part, separating with of

Date stuff is SO FUN. :-D

@kstapelfeldt kstapelfeldt added Subject: Dates related to managing dates in Islandora. Consider also using the search and metadata tags. and removed dates labels Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Subject: Dates related to managing dates in Islandora. Consider also using the search and metadata tags.
Projects
Development

No branches or pull requests

3 participants