Skip to content

Timestamps shown with wrong UTC offset (-08:00 instead of -07:00) in America/Vancouver after BC's move to permanent UTC-7 #10852

Open

Description

@alain-vandendorpe-wd

Describe the bug

After British Columbia's switch to year-round UTC-7 (MST as of tzdata 2026b onwards, including in the current 2026e), the AWS CLI prints every timestamp with a -08:00 offset, one hour behind local time. The OS clock and Python's stdlib both get -07:00 right.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Timestamps are rendered with the zone's actual current offset (-07:00), the same as date and datetime.fromtimestamp(ts).astimezone().

Current Behavior

Every timestamp the CLI renders (e.g. ECS createdAt/pullStartedAt) is shown with a -08:00 offset, one hour behind the system's actual offset of -07:00 (date reports MST). Setting TZ=UTC produces correct UTC output.

Reproduction Steps

On aws-cli 2.39.3 (latest), macOS 26.7.1, system timezone America/Vancouver (tzdata 2026e):

$ date
Wed Nov  4 11:13:36 MST 2026

$ aws ecs describe-tasks --cluster <cluster> --tasks <task> --query 'tasks[0].createdAt' --output text
2026-11-04T10:08:45.753000-08:00

$ TZ=UTC aws ecs describe-tasks --cluster <cluster> --tasks <task> --query 'tasks[0].createdAt' --output text
2026-11-04T18:08:45.753000+00:00

(18:08 UTC is 11:08 local, not 10:08.)

Minimal repro with the CLI's bundled interpreter and vendored botocore:

import time, datetime
from awscli.botocore.utils import parse_timestamp

ts = time.time()
print("botocore parse_timestamp:", parse_timestamp(ts))
print("stdlib astimezone():    ", datetime.datetime.fromtimestamp(ts).astimezone())
t = time.localtime()
print("tm_gmtoff", t.tm_gmtoff, "tm_isdst", t.tm_isdst, "tm_zone", t.tm_zone,
      "| time.timezone", time.timezone, "time.altzone", time.altzone)

Output:

botocore parse_timestamp: 2026-11-04 10:13:36.230687-08:00
stdlib astimezone():     2026-11-04 11:13:36.230687-07:00
tm_gmtoff -25200 tm_isdst 0 tm_zone MST | time.timezone 28800 time.altzone 25200

Possible Solution

For epoch values, awscli.botocore.utils.parse_timestamp calls datetime.datetime.fromtimestamp(value, tzinfo()), where on non-Windows platforms get_tzinfo_options() returns (dateutil.tz.tzlocal,). tzlocal() only knows two fixed offsets:

  • "standard" = -time.timezone. CPython derives this from Jan 1 of the current year, which in 2026 was still PST, so -08:00.
  • "DST" = -time.altzone, taken from Jul 1 (PDT), so -07:00.

It then picks one using tm_isdst. Since UTC-7 is now the zone's standard time, libc reports tm_isdst=0, so tzlocal() picks its "standard" offset, -08:00, even though tm_gmtoff is -25200 (-07:00).

This is the known dateutil limitation in dateutil/dateutil#1098 (open since 2020, no maintainer response). A related symptom is dateutil/dateutil#1009 and #6595 here (Europe/Dublin). The CLI also pins python-dateutil<=2.9.0, so an upstream fix wouldn't reach CLI users anyway.

It should fix itself on 2027-01-01, when Jan 1 and Jul 1 both report UTC-7. But any zone that changes its rules partway through a year will hit the same bug.

Suggested fix

Don't use tzlocal() to render epoch timestamps on POSIX. Let the stdlib apply the per-instant offset from libc, which is correct:

datetime.datetime.fromtimestamp(value).astimezone()

(or datetime.datetime.fromtimestamp(value, datetime.timezone.utc).astimezone())

Workaround

Run the CLI with TZ=UTC or with a fixed-offset zone such as TZ=America/Phoenix.

Additional Information/Context

No response

CLI version used

aws-cli/2.39.3 Python/3.15.2 Darwin/25.6.0 source/arm64

Environment details (OS name and version, etc.)

macOS 26.7.1, TZ 'America/Vancouver'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions