Skip to content

Improve date parsing#2731

Merged
koppor merged 19 commits into
masterfrom
fixDateParsing
Apr 17, 2017
Merged

Improve date parsing#2731
koppor merged 19 commits into
masterfrom
fixDateParsing

Conversation

@tobiasdiez

@tobiasdiez tobiasdiez commented Apr 12, 2017

Copy link
Copy Markdown
Member

This PR improves a few small things about the date parsing:

  • There were a few places where dates were parsed, for example in NormalizeDateFormatter, BibEntry and in some importer. All these code snippets are now merged in a new Date class. This resulted in more robust code and slightly improved parsing performance.
  • The MonthUtil class is now an enum with a few static helper methods.

  • Change in CHANGELOG.md described
  • Tests created for changes
  • Screenshots added (for bigger UI changes)
  • Manually tested changed features in running JabRef
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)
  • If you changed the localization: Did you run gradle localizationUpdate?

@tobiasdiez tobiasdiez added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Apr 12, 2017
* - "uuuu.M.d" (covers 2015.1.15)
* The code is essentially taken from http://stackoverflow.com/questions/4024544/how-to-parse-dates-in-multiple-formats-using-simpledateformat.
*/
public static Optional<Date> parse(String dateString) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically we should support all allowed date formats from biblatex: EDTF format
2.3.8 Date and Time Specifications
A while ago I looked into that and found that there is no easy way to support all in java.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved this into issue #2753

*/
public enum Month {

JANUARY("January", "jan", "01", "#jan#", 0),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the JAVA 8 Date Time changes, month now are 1-12 and no longer 0-11

@Siedlerchr

Copy link
Copy Markdown
Member

In general LGTM

journal = {Information Systems Architecture and Technology: Service Oriented Networked Systems},
year = {2011},
month = {mar},
month = {03},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't month = mar the correct format for BibTex?!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only, because many styles define the string mar. At least this is what I read from the discussion at https://tex.stackexchange.com/q/70455/9075.

@koppor koppor removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Apr 17, 2017
@koppor koppor merged commit 723af6d into master Apr 17, 2017
@koppor koppor deleted the fixDateParsing branch April 17, 2017 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants