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

new_interval output with Date object inputs #219

mwmclean opened this issue Dec 21, 2013 · 1 comment

new_interval output with Date object inputs #219

mwmclean opened this issue Dec 21, 2013 · 1 comment


Copy link

@mwmclean mwmclean commented Dec 21, 2013

I obtain unexpected results when giving Date objects to new_interval. Shouldn't the below code give the same output in both cases?

new_interval(ymd('2011-01-01'), ymd('2013-01-01'))
## 2011-01-01 UTC--2013-01-01 UTC

new_interval(as.Date('2011-01-01'), as.Date('2013-01-01'))
## 2010-12-31 18:00:00 CST--2012-12-31 18:00:00 CST

R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] lubridate_1.3.2

loaded via a namespace (and not attached):
[1] digest_0.6.3 memoise_0.1 plyr_1.8 stringr_0.6.2 tools_3.0.2

@vspinu vspinu closed this in d128299 Dec 14, 2014
Copy link

@vspinu vspinu commented Dec 14, 2014

It's the same interval but in different timezones. It's not necessarily wrong, but it goes agains the value of tz(as.Date('2011-01-01')) . So I have changed interval to default to UTC as other lubridate functions do.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants