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

excel_numeric_to_date converts incorrectly for dates between 1900-01-01 through 1900-02-28 #478

Closed
aetheogamout opened this issue Apr 15, 2022 · 5 comments

Comments

@aetheogamout
Copy link

Because of the 1900-02-29 bug in how excel represents dates in windows, representation of dates from 1900-01-01 and 1900-02-28 effectively use a different origin than dates 1900-03-01 on.

The result of this is that dates produced by excel_numeric_to_date(1:59) are off by one day from the date as shown in excel:

in R:
excel_numeric_to_date(1)
[1] "1899-12-31"

in a modern version of excel convert the number 1 to a date:

=TEXT(1, "yyyy-mm-dd")
1900-01-01

@billdenney
Copy link
Collaborator

You're right. This was fixed in #422, and it will be included in the next janitor release. If you need to use it now, you can do remotes::install_github("sfirke/janitor") to get the current development version.

As an aside (see #423), excel date handling before 1900-03-01 is poor (searching the internet for "excel older dates" and similar will show many issues).

@sfirke
Copy link
Owner

sfirke commented Apr 15, 2022 via email

@aetheogamout
Copy link
Author

Thanks! and apologies - I misread what #422 is fixing

@billdenney
Copy link
Collaborator

@aetheogamout , No worries at all. Excel dates present all sorts of unique problems.

@billdenney
Copy link
Collaborator

@sfirke, if it's CRAN release time, I'm gonna make a couple more PRs. Hopefully, I can do those later today.

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

No branches or pull requests

3 participants