Closed pitdicker closed 6 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 94.01%. Comparing base (
d286f93
) to head (7c53bd5
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
As I see it
DateTime::with_nanosecond
is one of the few methods onDateTime
that does not need to return an error from theTimeZone
trait and does not need to return aMappedLocalTime
.We assume in some places, like the platform code of
Local
, that time zone transitions happen on second boundaries. That seems entirely reasonable to me and fits with reality. There is also some similarity to how we assume offsets to be a round number of seconds from UTC.In the IANA time zone database there are some time zone offsets from the 19th century that have an offset with fractional seconds. Those are based on the longitude of a city or mean of the country. The fractional part is included with a comment, and the shipped data uses round seconds. Necessarily if anyone takes those fractional offsets serious, they would need a transitions at a fractional second at some point when the country aligns from local mean time to round offsets from UTC.
If we assume there are no subsecond transitions
DateTime::with_nanosecond
can just assume the entire second has the same offset from UTC.