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

MSBibEntry office xml import and (re-)export of yearAccessed monthAccessed dayAccessed #2859

Closed
gnu9 opened this issue May 22, 2017 · 3 comments
Assignees
Labels
bug Confirmed bugs or reports that are very likely to be bugs export / save import

Comments

@gnu9
Copy link

gnu9 commented May 22, 2017

Bug report: After import of fields yearAccessed monthAccessed dayAccessed from an office xml file, they are stored in format mm dd, yy in the field msbib-accessed (or mm dd, yyyy).

Re-export fails as it expects format \d{2}\s*[.,-/]\s*\d{2}\s*[.,-/]\s*\d{2,4} but \d{2} \d{2}, \d{2,4} doesn't match.

Possible fixes: change DATE_PATTERN s.t. month and day may be separated by \s*[ .,-/]
OR line 168 of MSBibEntry.java to sbDateAccesed.append(', '); (Typo "Accesed" present in source code).

Additionally, shouldn't the biblatex field "urldate" be exported to the fields yearAccessed monthAccessed dayAccessed in an office xml file? And vice versa for import? In that case importing into msbib-accessed should be replaced by importing into urldate (except for possible cases where urldate wouldn't be appropriate).

In case that urldate doesn't correspond to yearAccessed monthAccessed dayAccessed in some or all cases, importing into msbib-accessed could be changed to yyyy-mm-dd (yy-mm-dd) to make it coherent with biblatex date format. Parse msbib-accessed as year month date if pattern \d{2,4}\s*-\s*\d{2}\s*-\s*\d{2} is matched, if not try DATE_PATTERN \d{2}\s*[ .,-/]\s*\d{2}\s*[.,-/]\s*\d{2,4} for month year day.

@lenhard
Copy link
Member

lenhard commented May 22, 2017

@gnu9 Thanks for your report!

@Siedlerchr : You have worked on this, if I recall it correctly. Can you comment here?

@Siedlerchr Siedlerchr self-assigned this May 22, 2017
@Siedlerchr
Copy link
Member

Okay, I looked into the code and I think I can understand the issue with the regex. I would propse to store the date from import into yyyy-mm-ddd (ISO8601). I will try to get rid of the regex, as we have some methods for parsing dates in several formats. But as I am currently busy with another project it could take some time I can get to work on this

@tobiasdiez tobiasdiez added bug Confirmed bugs or reports that are very likely to be bugs export / save import labels May 22, 2017
Siedlerchr added a commit that referenced this issue May 24, 2017
* Fix export and import of MS office day/year/month acessed fields
Fix possible NPE in Date parsing
Fixes #2859

* Fix checkstyle

* Use Optionals instead of null
Throw npe on Date parsing with null

* Fix checkstyle
@Siedlerchr
Copy link
Member

The issue with the date exporting should be fixed now. Would you please create a new issue for the sugesestion about the urldate?`Makes it easier to keep track of it

We would like to ask you to use a development build from https://builds.jabref.org/master and report back if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs export / save import
Projects
None yet
Development

No branches or pull requests

4 participants