Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
with_tz silently gives wrong results for many timezones #469
I'm not sure if this should be considered a bug or a feature request:
The output from with_tz() seems un-trustworthy, because while SOME timezones work correctly, many others SILENTLY return incorrect results! When wrong, it appears that the time is actually still in UTC but is incorrectly labeled as being whatever timezone the user requested. If the timezone is unknown and thus will give wrong results, shouldn't an error or warning be thrown?
I get the same results with either lubridate_1.5.6.tar.gz or lubridate_1.6.0.tar.gz from CRAN, installed from source. Simple example:
You provided an answer to your cuestion. EDT, CST, CDT are not valid time zones on your system, which, for you, match with Olson's data base:
You can do
I wouldn't know a good solution for this as it's OS dependent. Valid timezones on some OSes need not be in Olson names. Even those in OlsonNames databases might not be valid. It's quite a mess. See R's docs for OlsonNames.
One solution would be to introduce a warning if tz is not in OlsonNames with the possibility to suppress it with an option.