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

Replace date with fields year and month for incomplete dates #1546

Closed
phdoerfler opened this issue Jun 18, 2020 · 6 comments
Closed

Replace date with fields year and month for incomplete dates #1546

phdoerfler opened this issue Jun 18, 2020 · 6 comments
Labels

Comments

@phdoerfler
Copy link

@phdoerfler phdoerfler commented Jun 18, 2020

Enhancement

Actual behavior

Currently BBT creates .bib entries like this:

@online{Panther2005,
  title = {Bayer {{Filter Goose}}},
  author = {{Panther}},
  date = {2005-02},
  url = {https://upload.wikimedia.org/wikipedia/commons/1/1b/Bayer_filter_all.png},
  file = {/Users/phi/Zotero/storage/ITJCBNKN/Panther - 2005 - Bayer Filter Goose.png},
  keywords = {SPIHT}
}

which generates the following warning when used with Biber:

'Panther2005' (bib/spiht.bib): Invalid format '2005-02' of date field 'date' - ignoring

Proposed behavior

I propose that instead any incomplete date field is dropped, i.e., all date fields that are not YYYY-MM-DD and are thus considered invalid by Biber.
Instead, the fields year and month could be used to encode incomplete dates.
Many publications do not provide a precise date with a day on which they were released but only a year and a month, sometimes just the year.

Right now, I have added tex.month and tex.year manually which results in this entry:

@online{Panther2005,
  title = {Bayer {{Filter Goose}}},
  author = {{Panther}},
  date = {2005-02},
  year = {2005},
  month = {02},
  url = {https://upload.wikimedia.org/wikipedia/commons/1/1b/Bayer_filter_all.png},
  file = {/Users/phi/Zotero/storage/ITJCBNKN/Panther - 2005 - Bayer Filter Goose.png},
  keywords = {SPIHT}
}

As expected, this still results in this warning message:

'Panther2005' (bib/spiht.bib): Invalid format '2005-02' of date field 'date' - ignoring

And this quality complaint in the generated .bib:

% Exactly one of 'date' / 'year' must be present

which I assume can be worked around by manually keeping BBT from exporting the date field on a per reference basis. I'd rather want this to be done automatically, however.

Report ID: 8DIR3AQ9-euc

Exporter used: Better BibLaTeX

@phdoerfler phdoerfler added the bug label Jun 18, 2020
@retorquere
Copy link
Owner

@retorquere retorquere commented Jun 18, 2020

@njbart? I thought date was always preferred over year and month?

Loading

@phdoerfler
Copy link
Author

@phdoerfler phdoerfler commented Jun 18, 2020

I couldn't find it in the documentation but I found out that by setting…

tex.date=

…it makes BBT omit date:

@online{Panther2005,
  title = {Bayer {{Filter Goose}}},
  author = {{Panther}},
  year = {2005},
  month = {02},
  url = {https://upload.wikimedia.org/wikipedia/commons/1/1b/Bayer_filter_all.png},
  file = {/Users/phi/Zotero/storage/ITJCBNKN/Panther - 2005 - Bayer Filter Goose.png},
  keywords = {SPIHT}
}

…which in turn makes Biber happy and gets rid of the warning. For me this is an acceptable work around for the time being and I guess I could write a javascript postscript that would do that but I'd rather not go down that rabbit hole for now. I still would much prefer if BBT was smart enough to do this on its own.
Also many thanks for making this wonderful extension in the first place ❤️

Loading

@retorquere
Copy link
Owner

@retorquere retorquere commented Jun 18, 2020

It'd be very easy for me to do if it is actually the desired behavior; I don't know, but @jnbart usually does.

Loading

@njbart
Copy link
Contributor

@njbart njbart commented Jun 18, 2020

In biblatex, date is indeed always preferred over year and month. (Quoting the manual (v 3.14, p. 26), on the year field, “It is however better to use the date field as this is compatible with plain years too and supports many more features.”) What’s more, the manual explicitly lists 1967-02 among the examples of valid date specifications (p. 38; and this hasn’t changed for, literally, decades). I can’t reproduce the alleged warning message either (using the most recent biber 2.14 and biblatex 3.14). So I don’t see any reason at all to change anything.

Loading

@phdoerfler
Copy link
Author

@phdoerfler phdoerfler commented Jun 18, 2020

tl;dr: The warnings went away mysteriously and I can no longer reproduce them either. I git stashed the changes to my .bib file that BBT did and then unstashed them which re-applied them again.

@njbart That is very interesting, thanks for digging this up! Today I have had massive problems with biblatex where it would fail the compile but report no errors. After hours of scratching my head, going through the generated .bib and never finding any gross mistake and repeatedly cleaning all generated files and changing things here and there I eventually stashed all the changes to my .bib file that Zotero did and went back to a previous version and closed Zotero which was, until then, running in the background.
With the changes stashed everything compiled fine, which was reassuring and what I hoped for and cautiously expected.

What I did not expect was this: I then re-applied the changes in my stash and lo and behold it still compiled. I cleaned up all auxiliary files that were generated by the compilation and tried again and it still compiled.

I have no idea why biblatex failed previously. Despite cleaning all generated files and even manually making sure everything but the .tex files and the .bib files was deleted it would still fail. I even restarted my entire machine to no avail. Aside from stashing and un-stashing the changes the only thing I did was to close Zotero. But if this even did anything I can not say.
It is troubling me that it is working again now and I do not know why.

One more thing that is noteworthy: There was one bib entry where biblatex would complain that 2004-09-27 was not a valid format for date. Which it clearly is. I was not able to find out what made this entry stand out from the others which had the same format but caused no complaints. Maybe it was the first one it processed since its citekey starts with an A and I think all the others come later. Either way, I'm glad this is over and I can no longer reproduce any of the warnings.
Unfortunately I did not check the .blg file because a couple hours ago I did not know that it might have contained information about the biblatex compilation. All I know is that biblatex exited with return code 2.

Loading

@phdoerfler phdoerfler closed this Jun 18, 2020
@label-gun label-gun bot reopened this Jun 18, 2020
@retorquere retorquere added question and removed bug labels Jun 18, 2020
@retorquere retorquere closed this Jun 18, 2020
@github-actions
Copy link

@github-actions github-actions bot commented Feb 17, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants