Skip to content

Support half-hour timezones #6277

Closed

Description

@AidanConnelly

Description

Hi!

It would be really call if typst's datetime.today() supported my Island's timezone, which is not an intedger

Use Case

I live in the wonderful Island of Newfoundland, which follows the Newfoundland Time Zone, it would be wonderful if we could have non-intedger timezone support in typst, as occasionally the current day (i.e. datetime.today()) is wrong due to us having a -3.5 hour offset timezone (except for DST, which is 2.5 hours)

Activity

  1. added
    feature request
    on May 13, 2025
  2. added
    bug
    and removed
    feature request
    on May 13, 2025
  3. t-rapp commented on May 14, 2025

    @t-rapp
    Contributor

    Indeed there are other timezones, like in Australia or Nepal that do not use full-hour offsets to UTC.

    When checking the popular chrono crate it requires an offset defined in seconds, see the FixedOffset struct. Maybe to support such exotic use-cases as Dublin Mean Time?

  4. added
    scripting
    on May 16, 2025
  5. Enter-tainer commented on May 19, 2025

    @Enter-tainer
    Contributor

    FWIW I believe we should use a timezone string instead of an offset when defining timezone offsets. Currently we either use local timezone or an int based hour offset.

    Some(hours) => {

  6. t-rapp commented on May 19, 2025

    @t-rapp
    Contributor

    @AidanConnelly: Just for my full understanding, do you use #datetime.today() in your Typst source with the offset parameter, or without? Do you compile the source file with the online Typst app, or locally using the command-line executable?

    In case you call #datetime.today() with the offset parameter, then the issue is about the limitation of the parameter to full hours. But in case you call it without the offset parameter and the date shown is still incorrect, then that would be an issue with the World implementation of the host application (command-line or web app).

    @Enter-tainer: Not sure I agree that offset should support timezone strings like "Australia/Sydney" or "AEST". That would imply that each client implementing the World trait has access to the tz database, either from the host OS or embedded within.

    In my opinion it would be enough to make offset accept a value of Duration type. That would allow users to get the current date with offset values like -3½ or +5¾ hour.

  7. Enter-tainer commented on May 19, 2025

    @Enter-tainer
    Contributor

    I guess we already have tz database embedded, since LocalTimezone works out of the box. Using UTC offset to define timezone is not a good practice, especially when dealing with DST.


    chrono = { version = "0.4.24", default-features = false, features = ["clock", "std"] }
    clock will introduce iana-time-zone https://docs.rs/crate/chrono/latest/features#clock

  8. AidanConnelly commented on Jun 5, 2025

    @AidanConnelly
    Author

    @AidanConnelly: Just for my full understanding, do you use #datetime.today() in your Typst source with the offset parameter, or without? Do you compile the source file with the online Typst app, or locally using the command-line executable?

    Hi! I use the offset parameter in the Typst app.

    In my opinion it would be enough to make offset accept a value of Duration type. That would allow users to get the current date with offset values like -3½ or +5¾ hour.

    I think this is how I'd about it if I were to write a PR for this issue, which I may do

  9. added 6 commits that reference this issue on Jan 13, 2026
    df9a12c
    65a3421
    8674a05
    02e1c25
    176ce26
    610f541
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

    bugscripting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions