tidyverse / lubridate

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

Use CONDA_PREFIX for timezone database if available #1119

Closed drhagen closed 1 year ago

drhagen commented 1 year ago

As discussed in #1117, this allows lubridate to use the timezone database in a conda environment if R is currently being executed in one. The conda environment is detected and located using the CONDA_PREFIX environment variable.

The behavior of lubridate was tested before and after this change. Indeed, the timezone information that is installed by the standard tzdata conda package at ${CONDA_PREFIX}/share/zoneinfo is detected and used.

Please check the logic around the handling of Windows. Because conda environment can exist on Windows (and are actually a very nice way to set up a scientific programming environment there), I reorganized the way tzdir_find works to avoid too much nesting.

vspinu commented 1 year ago

Thanks! Looks good. The windows treatment should be fine. Those paths don't make sense on windows indeed.