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
Copy file name to clipboardExpand all lines: README.md
+58-32
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,17 @@ Only run a task past a certain time of day, only accept submissions since a cert
6
6
7
7
Written in almost pure Gleam, Tempo tries to optimize for the same thing the Gleam language does: explicitness over terseness and simplicity over convenience. My hope is to make Tempo feel like the Gleam language and to make it as difficult to write time related bugs as possible.
8
8
9
+
Supports both the Erlang and JavaScript targets.
10
+
9
11
## Installation
10
12
11
13
```sh
12
14
gleam add gtempo
13
15
```
16
+
Supports timezones only through the `gtz` package. Add it with:
@@ -138,30 +167,27 @@ Further documentation can be found at <https://hexdocs.pm/gtempo>.
138
167
139
168
## Time Zone and Leap Second Considerations
140
169
141
-
This package purposefully **ignores leap seconds** and **will not convert between time zones**. Try to design your application so time zones do not have to be converted between and leap seconds are trivial. More below.
170
+
This package purposefully **ignores leap seconds** and **will not convert between time zones unless given a timezone provider**. Try to design your application so time zones do not have to be converted between and leap seconds are trivial. More below.
142
171
143
-
Both time zones and leap seconds require maintaining a manually updated database of location offsets and leap seconds. This burdens any application that uses them to keep their dependencies up to date and burdens the package by invalidating all previous versions when an update needs to be made.
172
+
Both time zones and leap seconds require maintaining a manually updated database of location offsets and leap seconds. This burdens any application that uses them to keep their dependencies up to date and burdens the package by either invalidating all previous versions when an update needs to be made or providing hot timezone data updates.
144
173
145
-
If at all possible, try to design your application so that time zones do not have to be converted between. Client machines should have information about their time zone offset that can be polled and used for current time time zone conversions. This package will allow you to convert between local time and UTC time on the same date as the system date.
174
+
If at all possible, try to design your application so that time zones do not have to be converted between. Client machines should have information about their time zone offset that can be polled and used for current time time zone conversions. This package will allow you to convert between local time and UTC time on the same date as the system date natively.
146
175
147
176
Since this package ignores leap seconds, historical leap seconds are ignored when doing comparisons and durations. Please keep this in mind when designing your applications. Leap seconds can still be parsed from ISO 8601 strings and will be compared correctly to other times, but will not be preserved when converting to any other time representation (including changing the offset).
148
177
149
178
When getting the system time, leap second accounting depends on the host's time implementation.
150
179
151
-
If you must, to convert between time zones with this package, use a separate time zone provider package to get the offset of the target time zone for a given date, then apply the offset to a `datetime` value (this time zone package is fictional):
180
+
If you must, to convert between time zones with this package, use a separate time zone provider package like `gtz`:
152
181
153
182
```gleam
154
183
import tempo/datetime
155
-
import timezone
184
+
import gtz
156
185
157
186
pub fn main() {
158
187
let convertee = datetime.literal("2024-06-12T10:47:00.000Z")
0 commit comments