Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of daylight savings time? #2

Open
Merlin04 opened this issue Mar 17, 2024 · 1 comment
Open

Example of daylight savings time? #2

Merlin04 opened this issue Mar 17, 2024 · 1 comment

Comments

@Merlin04
Copy link

Hi, I'm a bit confused about how I'd create a Timezone that accounts for daylight savings time - could you provide an example?

@mefyl
Copy link
Owner

mefyl commented Mar 18, 2024

Hi,

if you want the timezone of your local machine, including possible DST, link with the timmy.clock library and use Clock.timezone_local. You'll need to pick the correct implementation in the final executable, that is timmy-unix.clock on desktop and timmy-jsoo.clock in javascript.

The idea of the clock library is that Timmy only contains generic algorithms on dates and times, and clock provides anything platform specific and environment dependent.

If you want another timezone with DST, you must use Timezone.of_implementation and provide a way to compute the DST offset at any timepoint or datetime. The rationale for not providing this is that it would require a large database of all existing timezone and DST on earth, which may become obsolete at any point. Timmy does not provide specific timezone per se, timmy.clock provides the local timezone of your machine, another package could provide all potential timezone on earth. If you need all timezones, maybe take a look at Timere. If you only need the local timezone, timmy.clock will do the deed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants