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

Bibtex months are expected in English #29

Merged
merged 1 commit into from Jun 24, 2017

Conversation

Projects
None yet
3 participants
@zeehio
Copy link
Contributor

zeehio commented Jun 9, 2017

Most bibtex entries are in English, so we should expect the months to be in English as well. lubridate::parse_date_time uses the current locale instead of the English "C" locale.

When I get a bib entry from its DOI using DOIRefManageR::GetBibEntryWithDOI("10.1016/j.cccn.2004.04.023"), the year and month are specified as "2004" and "sep" respectively.

I get a warning when I try to print the entry. I have traced the warning to this function call:

RefManageR:::ProcessDate("2004", "sep")
#[1] "2004-01-01 CET"
#Warning messages:
#1: All formats failed to parse. No formats found. 
#2: In RefManageR:::ProcessDate("2004", "sep") :
# Failed to parse month: sep. Ignoring and using year only.

This issue happens because my locale is not English, so this is my workaround:

Sys.setlocale(locale="C") # default C locale
RefManageR:::ProcessDate("2004", "sep")
[1] "2004-09-01 UTC"

This PR tells lubridate to use the English locale to parse the month, fixing this issue.

Bibtex months are expected in English
Most bibtex entries are in English, so we should expect the months to be in English as well. `lubridate::parse_date_time` uses the current locale instead of the English "C" locale.
@mwmclean

This comment has been minimized.

Copy link
Collaborator

mwmclean commented Jun 15, 2017

Thanks for the pull request. Could you please tell me what version of lubridate you are using? Reading the NEWS for that package seems to indicate that this shouldn't be an issue with the latest version of lubridate on CRAN.

@coveralls

This comment has been minimized.

Copy link

coveralls commented Jun 15, 2017

Coverage Status

Coverage decreased (-0.01%) to 74.372% when pulling 6c65675 on zeehio:patch-1 into 5498e23 on mwmclean:master.

@zeehio

This comment has been minimized.

Copy link
Contributor Author

zeehio commented Jun 15, 2017

Oh right, I might have been at lubridate 1.5 (I am not in the computer now, but it was a CRAN installation). I'm sorry.

Just to stay on the safe side, maybe RefManageR could depend on lubridate >= 1.6 (instead of 1.5) so we guarantee this issue is fixed? I will check later the version to confirm, just in case.

Thanks!

@mwmclean

This comment has been minimized.

Copy link
Collaborator

mwmclean commented Jun 15, 2017

Yes, that's what I was planning, assuming that does indeed fix your issue.

@zeehio

This comment has been minimized.

Copy link
Contributor Author

zeehio commented Jun 16, 2017

I was using lubridate 1.6.0. There was a bug in lubridate with month capitalization that is fixed in the development version of lubridate: tidyverse/lubridate#529

The second example fails due to the month being in lower case:

  • lubridate::parse_date_time("2004-Sep-01", "%Y-%b-%d") (works on 1.6.0)
  • lubridate::parse_date_time("2004-sep-01", "%Y-%b-%d") (fails on the last 1.6.0 release, works in dev version)

So the solution here will be to depend on the next lubridate version. Feel free to close this pull request (or keep it open as a reminder).

Thanks for your time!

@mwmclean mwmclean merged commit 6c65675 into ropensci:master Jun 24, 2017

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.01%) to 74.372%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

mwmclean added a commit that referenced this pull request Jun 24, 2017

@zeehio zeehio deleted the zeehio:patch-1 branch Feb 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment