-
Notifications
You must be signed in to change notification settings - Fork 132
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 leap day bug #422
Excel leap day bug #422
Conversation
# Conflicts: # R/excel_dates.R
Codecov Report
@@ Coverage Diff @@
## master #422 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 950 958 +8
=========================================
+ Hits 950 958 +8
|
Hmm, Windows and Mac work while Linux does not. This will take some investigation. |
Fix #420 |
Looks good to me, thank you for fixing both of these! Edge cases to be sure, but also definitely incorrect behavior (thanks Microsoft). I will see if I can poke at the Linux test failure and get anywhere. |
Indeed, those tests fail for me on my Ubuntu machine. This works, when it shouldn't:
And this errors before the comparison it is part of can be executed;
|
I think that this is a subtle bug in as.POSIXct.numeric() where all NA inputs should return NA rather than requiring the origin. (I'm kinda surprised that we discovered a base R bug...) We should probably just add an |
I found a few issues with as.POSIXct and as.POSIXlt while working through this. A simpler solution may be to add lubridate as a dependency and use its date creation which seems to work correctly for daylight savings times. What do you think about a lubridate dependency? |
Relying on lubridate to sweat the details around dates sounds wise to me! 🦉 No worries about adding that dependency, virtually everyone using this package will have it installed as part of tidyverse anyway. |
It turns out that we already had lubridate as a dependency due to |
Looks great, thank you for digging in to sort this out so carefully 🙏 |
I think this closes #420, is that right? |
It does. |
29 Feb 1900 is not a real date (it does not exist on real calendars), but it does exist in Excel. This makes it a warning to have an Excel numeric date of 29 Feb 1900 and converts the value to NA. (Applied on top of #421 since there is an interaction.)