uribo / zipangu

Japanese utility functions and data
https://uribo.github.io/zipangu
Other
56 stars 7 forks source link

is_jholiday returns incorrect result if `lubridate.week.start option` is set to other than Sunday #40

Closed hidekoji closed 2 years ago

hidekoji commented 2 years ago

For example, if you set the week start day as Monday, 2019-10-08 is recognized as a Japanese Holiday where it shouldn't.

options(lubridate.week.start=7);  #Sunday
zipangu::is_jholiday("2019-10-08"); # It's correct.
#> [1] FALSE
options(lubridate.week.start=1);  #Monday
zipangu::is_jholiday("2019-10-08") # It's incorrect.
#> [1] TRUE

Created on 2022-02-21 by the reprex package (v2.0.1)

> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6

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

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

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

other attached packages:
[1] zipangu_0.2.3.9000

loaded via a namespace (and not attached):
 [1] pillar_1.6.4     compiler_4.1.0   highr_0.9        tools_4.1.0      digest_0.6.28   
 [6] lubridate_1.8.0  evaluate_0.14    lifecycle_1.0.1  tibble_3.1.5     pkgconfig_2.0.3 
[11] rlang_0.4.12     reprex_2.0.1     DBI_1.1.1        cli_3.1.0        rstudioapi_0.13 
[16] yaml_2.2.1       xfun_0.27        fastmap_1.1.0    withr_2.4.2      dplyr_1.0.7     
[21] knitr_1.36       generics_0.1.1   fs_1.5.0         vctrs_0.3.8      tidyselect_1.1.1
[26] glue_1.4.2       R6_2.5.1         processx_3.5.2   fansi_0.5.0      rmarkdown_2.11  
[31] callr_3.7.0      purrr_0.3.4      clipr_0.7.1      magrittr_2.0.1   ps_1.6.0        
[36] ellipsis_0.3.2   htmltools_0.5.2  assertthat_0.2.1 utf8_1.2.2       crayon_1.4.2    
>