Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

new_interval output with Date object inputs #219

Closed
mwmclean opened this issue Dec 21, 2013 · 1 comment
Closed

new_interval output with Date object inputs #219

mwmclean opened this issue Dec 21, 2013 · 1 comment

Comments

@mwmclean
Copy link

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

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

locale:
[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 as completed in d128299 Dec 14, 2014
@vspinu
Copy link
Member

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.

Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants