You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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?
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.
@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.
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.
@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
Activity
t-rapp commentedon May 14, 2025
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?
Enter-tainer commentedon May 19, 2025
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.
typst/crates/typst-cli/src/world.rs
Line 227 in d204a28
t-rapp commentedon May 19, 2025
@AidanConnelly: Just for my full understanding, do you use
#datetime.today()in your Typst source with theoffsetparameter, 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 theoffsetparameter, then the issue is about the limitation of the parameter to full hours. But in case you call it without theoffsetparameter and the date shown is still incorrect, then that would be an issue with theWorldimplementation of the host application (command-line or web app).@Enter-tainer: Not sure I agree that
offsetshould support timezone strings like "Australia/Sydney" or "AEST". That would imply that each client implementing theWorldtrait has access to the tz database, either from the host OS or embedded within.In my opinion it would be enough to make
offsetaccept a value ofDurationtype. That would allow users to get the current date with offset values like -3½ or +5¾ hour.Enter-tainer commentedon May 19, 2025
I guess we already have tz database embedded, since
LocalTimezoneworks out of the box. Using UTC offset to define timezone is not a good practice, especially when dealing with DST.typst/Cargo.toml
Line 44 in d204a28
clockwill introduceiana-time-zonehttps://docs.rs/crate/chrono/latest/features#clockAidanConnelly commentedon Jun 5, 2025
Hi! I use the
offsetparameter in the Typst app.I think this is how I'd about it if I were to write a PR for this issue, which I may do
Accept `Duration` type timezone offset values
Accept `Duration` type timezone offset values
Accept `Duration` type timezone offset values
Accept Duration type timezone offset values
Accept Duration type timezone offset values
Accept `Duration` type timezone offset values