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

as.IDate returns NAs when converting from POSIX #3780

Closed
gschett opened this issue Aug 19, 2019 · 2 comments · Fixed by #3781
Closed

as.IDate returns NAs when converting from POSIX #3780

gschett opened this issue Aug 19, 2019 · 2 comments · Fixed by #3781
Milestone

Comments

@gschett
Copy link

@gschett gschett commented Aug 19, 2019

Hello,

when converting a POSIX to an IDate, for certain time zone settings as.IDate returns NAs instead of the correct date. For example, this is the case for

as.IDate(as.POSIXct("1900-01-01",tz="UTC"))

The same happens, if I change the time zone to GTM, but interestingly it works just fine for CET or EST.

As a console output I get the following warning:

Warning message:
In setattr(as.integer(x)%/%86400L, "class", c("IDate", "Date")) :
  NAs introduced by coercion to integer range
Output of sessionInfo():

R version 3.6.0 (2019-04-26)

Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 14393)

Matrix products: default

locale:
[1] LC_COLLATE=German_Austria.1252  LC_CTYPE=German_Austria.1252    LC_MONETARY=German_Austria.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Austria.1252    

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

other attached packages:
 [1] readr_1.3.1       readxl_1.3.1      dygraphs_1.1.1.6  ggplot2_3.2.0     lubridate_1.7.4  
 [6] xts_0.11-2        zoo_1.8-6         data.table_1.12.2 dplyr_0.8.2       shiny_1.3.2      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1         cellranger_1.1.0   RColorBrewer_1.1-2 pillar_1.4.2       compiler_3.6.0    
 [6] later_0.8.0        tools_3.6.0        zeallot_0.1.0      digest_0.6.19      jsonlite_1.6      
[11] tibble_2.1.3       gtable_0.3.0       lattice_0.20-38    pkgconfig_2.0.2    rlang_0.4.0       
[16] cli_1.1.0          rstudioapi_0.10    crosstalk_1.0.0    yaml_2.2.0         withr_2.1.2       
[21] stringr_1.4.0      hms_0.4.2          vctrs_0.1.0        htmlwidgets_1.3    DT_0.7            
[26] grid_3.6.0         tidyselect_0.2.5   glue_1.3.1         R6_2.4.0           fansi_0.4.0       
[31] tidyr_0.8.3        purrr_0.3.2        magrittr_1.5       backports_1.1.4    scales_1.0.0      
[36] promises_1.0.1     htmltools_0.3.6    assertthat_0.2.1   mime_0.7           xtable_1.8-4      
[41] colorspace_1.4-1   httpuv_1.5.1       labeling_0.3       utf8_1.1.4         stringi_1.4.3     
[46] lazyeval_0.2.2     munsell_0.5.0      crayon_1.3.4
@MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Aug 19, 2019

Thanks for the report. Should be fixed in #3781

@MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Aug 20, 2019

If you can't update or install from dev, you could fix this in the CRAN version with as.Date before as.IDate

@mattdowle mattdowle added this to the 1.12.4 milestone Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants