Repository navigation
Add timezone support to date extension (#2225) - #2526
Conversation
dd40f22 to
07c7a4c
Compare
Allow users to format dates in different timezones using the optional 'tz' parameter. Supports IANA timezone names (e.g., UTC, America/New_York, Europe/Paris) and falls back to local time for invalid timezones. - Add chrono-tz dependency for timezone support - Implement timezone conversion in date extension - Add error handling for invalid date formats (compatible with espanso#2516) - Add tests for UTC, named timezones, and invalid timezone fallback
07c7a4c to
7d0f404
Compare
|
I like this! I think it need a tiny bit more before merging:
I test it and it worked a bit slowly, but it may well be because I'm having too many proceses in my PC. I'm going to skip this merge with the upcoming release, and merge after 👌🏼 . |
|
I'm pleased to see this. It'll render my time-zone Gist obsolete! A suggestion for the future: Would it be possible to reconfigure espanso-render/src/extension/date.rs to accept Espanso {{variablel}} offsets, as well as integers? |
|
@AucaCoyan I added modifications to adress this when I saw your comment. |
|
Thank you! |
|
Done! ~600 TZs added |
|
It works! 🎉 🚀
(it's 11:30 on Argentina now) Thank you so much @gcailly ! |
|
Note that - trigger: ":today"
replace: "{{mytime}}"
vars:
- name: mytime
type: date
params:
format: "%H:%M"
locale: en-AG
tz: America/Los_Angeles
params:
format: "%H:%M"
locale: en-AG
tz: America/Los_Angeles
... Apparently there is some missbehaviour with locales and languages: params:
tz: America/Argentina/Buenos_Airesor params:
locale: es-AR
tz: America/Argentina/Buenos_Airesboth prints |
* Add timezone support to date extension (espanso#2225) Allow users to format dates in different timezones using the optional 'tz' parameter. Supports IANA timezone names (e.g., UTC, America/New_York, Europe/Paris) and falls back to local time for invalid timezones. - Add chrono-tz dependency for timezone support - Implement timezone conversion in date extension - Add error handling for invalid date formats (compatible with espanso#2516) - Add tests for UTC, named timezones, and invalid timezone fallback * Add tz parameter to date extension JSON schema (espanso#2225) * move deps into the workspace * add enum of timezones ---------

Allow users to format dates in different timezones using the optional 'tz' parameter. Supports IANA timezone names (e.g., UTC, America/New_York, Europe/Paris) and falls back to local time for invalid timezones.
Fixes #2225