JuliaTime / TimeZones.jl

IANA time zone database access for the Julia programming language
Other
86 stars 51 forks source link

Update ZonedDateTime constructor to clarify behaviour when from_utc=false #367

Open iamed2 opened 2 years ago

iamed2 commented 2 years ago

I got caught by this and almost assumed something incorrect about the downstream CloudWatchLogs.jl library. The "instead of in local time" clause implied to me that when from_utc=false the DateTime would be converted from localzone() into the specified TimeZone, but that is not the case.

codecov-commenter commented 2 years ago

Codecov Report

Merging #367 (e881857) into master (e0a66bf) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #367   +/-   ##
=======================================
  Coverage   93.75%   93.75%           
=======================================
  Files          31       31           
  Lines        1553     1553           
=======================================
  Hits         1456     1456           
  Misses         97       97           
Impacted Files Coverage Δ
src/types/zoneddatetime.jl 96.15% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e0a66bf...e881857. Read the comment docs.

omus commented 2 years ago

The "instead of in local time" clause implied to me that when from_utc=false the DateTime would be converted from localzone() into the specified TimeZone, but that is not the case.

Definitely seems to be a perspective issue. The original documentation was written with the idea that it was known that internally a UTC datetime is stored. The primary reason from_utc is for performance reasons so using the term "convert" could been interpreted that using from_utc=true is slower.