Skip to content

Conversation

@elliotgnn
Copy link

Closes #10822

This PR adds Automatic Date Groups feature to JabRef. Users can create automatic groups by year, by year-month or by full date when the date field of entries are set. Membership is dynamic—no manual assignment. The following are the specifics of implementation.

Model

  • DateGranularity enum: YEAR, MONTH, FULL_DATE.
  • DateGroup extends AbstractGroup: represents a single key like 2024, 2024-10, or 2024-10-14. Matching uses JabRef’s aliasing (date ↔ year/month/day).
  • AutomaticDateGroup: builds child DateGroups for all entries at the chosen granularity and merges identical keys.

Serialization

  • GroupsParser: read/write support for AutomaticDateGroup. Deserialization is tolerant—if the granularity token is missing/invalid, it defaults to YEAR (backward-compatible with older libraries).
  • Other change for serialization and deserialization support for AutomaticDateGroup is also added in jablib/src/main/java/org/jabref/logic/exporter and jablib/src/main/java/org/jabref/logic/importer folder

GUI

  • Group dialog option “Automatically create groups by date” with:
    • Granularity selector (defaults to YEAR)
  • Group tree shows automatic subgroups and keeps them in sync as entries change.
  • Changes in gui/groups folder

Steps to test

Automated tests

Corresponding unit and integration tests for model, logic have been added for testing feature and persistence, in order to run them user can execute the command:

./gradlew :jablib:test --tests "org.jabref.model.groups.AutomaticDateGroupTest" 
./gradlew :jablib:test --tests "*GroupSerializerTest*" --tests "*GroupsParserTest*"

Manual Test

Manual Test can also be carried out through directly interacting with the GUI, steps will be:

  1. running the following command:
    ./gradlew :jabgui:run
  2. once the software starts running click +Add group under walkthrough section to generate example entries
  3. Click Add Group at the lower left corner
  4. Select Date option under Collect by section and you can keep the default granularity for DATE and YEAR
  5. Click OK
  6. Then the Grouping will be completed

Below are the Demonstration images:
step 2:
image
step 3:
image
step 4:
image
step 5:
image

Mandatory checks

Sheng Wang and others added 24 commits October 14, 2025 20:00
…c tests currently only group based on year not months
…year following month and day, changing AutomaticDateGroup/DateGroup+ DateGranularity + tests (year/month/day)
Model of auto date groups complelte and the test added
- Add AUTOMATIC_DATE_GROUP_ID constant to MetadataSerializationConfiguration
- Implement serializeAutomaticDateGroup() in GroupSerializer
  * Serializes field name
  * Serializes granularity (YEAR/MONTH/FULL_DATE)
- Add AutomaticDateGroup case in serialization switch
- Add getField() and getGranularity() methods to AutomaticDateGroup
- Fix deepCopy() and hashCode() to include granularity

Serialization format: AutomaticDateGroup:name;context;field;granularity;...
- Add AutomaticDateGroup and DateGranularity imports to GroupsParser
- Implement automaticDateGroupFromString() method
  * Parse name, context, field from serialized string
  * Parse and convert granularity string to DateGranularity enum
  * Create AutomaticDateGroup with all parameters
  * Restore group details (color, icon, description)
- Add condition check in fromString() to handle AutomaticDateGroup

This enables AutomaticDateGroup to be loaded from .bib files,
completing the save/load cycle with serialization.
Serialization tests (GroupSerializerTest.java):
- Test YEAR granularity serialization
- Test MONTH granularity serialization
- Test serialization with color, icon, and description
- Verify format: AutomaticDateGroup:name;context;field;granularity;...

Deserialization tests (GroupsParserTest.java):
- Test parsing YEAR granularity
- Test parsing MONTH granularity
- Test parsing FULL_DATE granularity
- Test parsing with color, icon, and description
- Verify correct object reconstruction from string

Total: 7 new test cases covering all granularity types and edge cases.
Checkstyle reported DateGranularity as an unused import because
we only use it through method return type inference (getGranularity().name()).
The import is not needed since we don't declare any variables of this type.
- Document DateGranularity enum values
- Add class-level documentation for DateGroup
- Ensures these files are detected as changed files in CI for JBang testing
Implement the GUI for auto date grouping
Syncing the upstream update
@github-actions
Copy link
Contributor

Hey @elliotgnn!

Thank you for contributing to JabRef! Your help is truly appreciated ❤️.

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.

@elliotgnn elliotgnn changed the title Implmentation issue 10822 Automatic Grouping By Date Implmentation new feature Automatic Grouping By Date Oct 25, 2025
@elliotgnn elliotgnn changed the title Implmentation new feature Automatic Grouping By Date Implmentation requested new feature Automatic Grouping By Date Oct 25, 2025
@subhramit
Copy link
Member

Please provide steps to test without using a walkthrough.

@calixtus calixtus changed the title Implmentation requested new feature Automatic Grouping By Date Automatic Grouping By Date Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an option to create automatic keyword groups by Year independent of date or year field content

5 participants