tidyverse / lubridate

Make working with dates in R just that little bit easier
https://lubridate.tidyverse.org
GNU General Public License v3.0
728 stars 207 forks source link

ymd_hm() returns NA since lubridate 1.9.0 #1092

Closed skr5k closed 1 year ago

skr5k commented 1 year ago

I updated to lubridate 1.9.0 this week and noticed that ymd_hm() fails since the update while ymd_hms() still works perfectly fine.

lubridate::ymd_hms("2022-11-05 12:00:00", tz = "GMT")
[1] "2022-11-05 12:00:00 GMT"

but

lubridate::ymd_hm("2022-11-05 12:00", tz = "GMT")
Warning message:
“All formats failed to parse. No formats found.”
[1] NA

Anyone else noticing that?

Here's my session info:

R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=de_DE.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
 [1] lubridate_1.9.0  getPass_0.2-2    fansi_1.0.3      crayon_1.5.2    
 [5] digest_0.6.30    utf8_1.2.2       IRdisplay_1.1    repr_1.1.4      
 [9] lifecycle_1.0.3  jsonlite_1.8.3   evaluate_0.18    pillar_1.8.1    
[13] rlang_1.0.6      cli_3.4.1        uuid_1.1-0       generics_0.1.3  
[17] vctrs_0.5.0      IRkernel_1.3     tools_4.2.2      glue_1.6.2      
[21] fastmap_1.1.0    compiler_4.2.2   timechange_0.1.1 base64enc_0.1-3 
[25] pbdZMQ_0.3-8     htmltools_0.5.3 
msaltieri commented 1 year ago

If it can help, I have the exact same problem on Linux Ubuntu 22.04. But the tests on Mac OSX work perfectly.

> lubridate::ymd_hm("2022-11-05 12:00", tz = "GMT")
[1] "2022-11-05 12:00:00 GMT"

With this session:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.0

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] it_IT.UTF-8/it_IT.UTF-8/it_IT.UTF-8/C/it_IT.UTF-8/it_IT.UTF-8

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

other attached packages:
[1] lubridate_1.9.0  timechange_0.1.1

loaded via a namespace (and not attached):
[1] compiler_4.2.1 generics_0.1.3 tools_4.2.1    renv_0.16.0
vspinu commented 1 year ago

Thanks! Introduced this while fixing #1003 but didn't have tests for this case :sob: