Glistix fork of birl
, a Date/Time handling library for Gleam.
Adds support for the Nix target. For that, implements the algorithms at http://howardhinnant.github.io/date_algorithms.html.
Its documentation can be found at https://hexdocs.pm/birl.
Due to purity constraints, the Nix target cannot access the local timezone of the system.
However, it can access the current time, but only outside pure-eval mode (otherwise it's
assumed to be Jan 1, 1970, or 0 in Unix time). Do note, however, that accessing the current time
can only be done once per evaluation (later calls to now()
always return the same result).
Otherwise, the functions and algorithms should work just fine (just try not to depend on the current time).
nix develop # Optional: Enter a shell with glistix
glistix run # Run the project
glistix test # Run the tests
Currently, you will need to add this package as a local dependency to a Git submodule in your project.
You can do so following steps similar to glistix/stdlib
.
import birl
import birl/duration
pub fn main() {
let now = birl.now()
let two_weeks_later = birl.add(now, duration.weeks(2))
birl.to_iso8601(two_weeks_later)
}