Skip to content

In DuckDB Wasm, default time zone calculated from browser has inverted offset #19916

@jraymakers

Description

@jraymakers

What happens?

The default timezone of DuckDB Wasm in a browser has an offset inverted from what it should be.

This is because of the opposite conventions used by the Etc/GMT time zones and the UTC offsets. Browsers often report the time zone as a UTC offset, which aren't in the IANA database. This recent PR handles converting those to Etc/GTM time zones, but doesn't handle this sign inversion properly.

To Reproduce

Using DuckDB Wasm in a browser, with a machine set to a non-zero time zone offset from UTC, run a statement such as select '2025-01-01 00:00:00+00'::timestamptz::varchar, or select current_setting('timezone'). If the latter returns an Etc/GMT time zone, then you should notice that the offset is the opposite of what it should be according to the machine's time zone.

OS:

Chrome / Mac OS X

DuckDB Version:

1.4.2

DuckDB Client:

duckdb-wasm@1.31.1-dev31.0

Hardware:

Apple M2 Max

Full Name:

Jeff Raymakers

Affiliation:

MotherDuck

Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?

  • Yes, I have

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions