Skip to content
An object for DateTime and duration manipulation
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Recto @ 132da42
.gitmodules
README.md
main.wren
tempo.wren

README.md

wren-tempo

A DateTime and Duration parsing, stringifying, and manipulation library

Warning: if cloning, make sure you've installed the Recto submodule

Exposes two Objects: DateTime and Duration, which can both be constructed with unix or iso

  • DateTime.unix(_): input a number of seconds since Jan 1st 1970 and get a DateTime object
  • DateTime.iso(_): input a string in the format "2017-07-23T18:57:23Z"and get a DateTime
  • Duration.unix(_): input a number of seconds and get a Duration
  • Duration.iso(_): input a string in the format "2017-07-23T18:57:23Z", and get a Duration. doesn't really make sence, but what are you going to do..?

Currently lacks locales or timezones, please open an issue if you're using this library and need this functionality.

toString currently always formats the Tempo object as if it were a date, need to fix that

ToDo:

  • duration toString formatting
  • less fragile iso string parseing
  • custom input/output string formats based on template strings
  • fromNow stringifer ( eg:"3 days from now" producer)
You can’t perform that action at this time.