Skip to content

as.IDate returns NAs when converting from POSIX #3780

@gschett

Description

@gschett

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions