Module : thyme

Module Overview

Thyme aims to work in harmony with the stdlib time module while enhancing the experience for developers, so they can concentrate on building their widget. Inspired by the great options available in other languages; such as Momentjs, Arrow, Pendulum, and others.

Documentation: i-dont-remember.github.io/thyme/.

Note: Until it has reached version 1.0, there will be breaking changes as I figure out improvements and what direction to take it. If you are interested in using the module and worried about things breaking, please reach out so I know and can adjust, otherwise I will rampage through this codebase with no regard.

Usage

See examples provided in the docs linked above.

TIME_UNIT_OPTIONS / DURATION_UNIT_OPTIONS

In the current implementation, duration matches these except for zoneId. In the future, it may switch to duration using suffix -s as it sounds a little nicer.

[
    "millisecond",
    "second",
    "minute",
    "hour",
    "day",
    "week",
    "month",
    "year",
    "zoneId"
];

Contributions

Issues and PRs are more than welcome! Feel free to reach out if you have any questions.

Misc

A neat piece of time info, according to unixtimestamp.com:

What happens on January 19, 2038? On this date the Unix Time Stamp will cease to work due to a 32-bit overflow. Before this moment millions of applications will need to either adopt a new convention for time stamps or be migrated to 64-bit systems which will buy the time stamp a "bit" more time.

Objects

Datetime WIP To be a wrapper around time:Time with simpler access to utility functions about that particular instance of time.
Duration Represents a mutable chunk of time without particular start or end.

Functions

add Easier version of time:addDuration.
difference Find the difference between two time:Time.
duration Create a Duration from a map.
fromMillis Convert from milliseconds to a unit.
fromTimestamp Create time:Time from a unix timestamp.
now A simple wrapper to get a new Datetime object from time:currentTime.
set Update a time:Time attribute Note: Not a conversion, just directly changing attributes.
setFromMap Update a time:Time with a map of the fields to change.
subtract Easier version of time:subtractDuration.
toMillis Convert from a unit to milliseconds.