jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Add support for date ranges for BibLaTeX Date

Open Alex1034 opened this issue 1 month ago • 7 comments

Closes https://github.com/JabRef/jabref/issues/8902

Summary

This pull request adds support for date ranges in BibLaTeX date fields.

Previously, JabRef only supported single dates (e.g., 2021-05-03).
With this change, JabRef now correctly parses and formats date ranges (e.g., 2020/2021, 2015-01-01/2016-12-31) in compliance with ISO 690 and BibLaTeX standards.

Steps to test

  1. Open the entry editor and locate the Date field.
  2. Try entering a date range, e.g.:
    • 2020/2021
    • 2021-05-01/2021-06-30
  3. Save and reopen the entry.
  4. Confirm that both start and end dates are parsed and displayed correctly.
  5. Export the entry to ensure the field is saved as date = {2020/2021}.

Additional details

  • Updated Date.java to normalize and handle start/end dates.
  • Updated DateEditorViewModel.java to correctly format and display date ranges.
  • Added normalization for incomplete date ranges (e.g., "2010/" → "2010").
  • Updated CHANGELOG.md under the [Unreleased] section.

Changelog

  • [ ] I have modified CHANGELOG.md appropriately.

PR Checklist

  • [x] I have followed the contributing guidelines
  • [x] I have written tests for the change
  • [x] I have added an entry to the changelog
  • [x] I have manually tested the change in JabRef
  • [x] My code follows the project’s code style and passes existing tests
  • [x] I have considered security implications

Alex1034 avatar Nov 11 '25 21:11 Alex1034

Hey @Alex1034!

Thank you for contributing to JabRef! Your help is truly appreciated :heart:.

We have automatic checks in place, based on which you will soon get automated feedback if any of them are failing. We also use TragBot with custom rules that scans your changes and provides some preliminary comments, before a maintainer takes a look. TragBot is still learning, and may not always be accurate. In the "Files changed" tab, you can go through its comments and just click on "Resolve conversation" if you are sure that it is incorrect, or comment on the conversation if you are doubtful.

Please re-check our contribution guide in case of any other doubts related to our contribution workflow.

github-actions[bot] avatar Nov 11 '25 21:11 github-actions[bot]

Note that your PR will not be reviewed/accepted until you have gone through the mandatory checks in the description and marked each of them them exactly in the format of [x] (done), [ ] (not done yet) or [/] (not applicable).

jabref-machine avatar Nov 23 '25 20:11 jabref-machine

Your code currently does not meet JabRef's code guidelines. IntelliJ auto format covers some cases. There seem to be issues with your code style and autoformat configuration. Please reformat your code (Ctrl+Alt+L) and commit, then push.

In special cases, consider using // formatter:off and // formatter:on annotations to allow deviation from the code style.

jabref-machine avatar Nov 23 '25 21:11 jabref-machine

JUnit tests of jablib are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

jabref-machine avatar Nov 23 '25 21:11 jabref-machine

You have removed the "Mandatory Checks" section from your pull request description. Please adhere to our pull request template.

jabref-machine avatar Nov 23 '25 22:11 jabref-machine

You ticked that you modified CHANGELOG.md, but no new entry was found there.

If you made changes that are visible to the user, please add a brief description along with the issue number to the CHANGELOG.md file. If you did not, please replace the cross ([x]) by a slash ([/]) to indicate that no CHANGELOG.md entry is necessary. More details can be found in our Developer Documentation about the changelog.

jabref-machine avatar Nov 23 '25 22:11 jabref-machine

Your pull request conflicts with the target branch.

Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

github-actions[bot] avatar Dec 01 '25 00:12 github-actions[bot]