#date-time #day #cli-tool #calculate #utility #calculating #numbers

app days

Command-line utility to calculate numbers of days between dates

1 unstable release

0.1.0 May 24, 2023

#2163 in Command line utilities

Unlicense

7KB

days

A simple CLI tool for calculating how far away dates are from each other. Inspired by WolframAlpha's ability to do this with natural language inputs.

The focus is primarily on days as the unit of time (hence the name of the crate), but support for other units of time — both small and large — is planned.

Features:

  • Calculate the date N days from today.
  • Calculate how many days are left until a given date.
  • Calculate how many days have passed since a given date.

Usage

# install it
cargo install days
# use it!
days since 1970-01-01

Supported commands

You can always run days --help to see the supported commands.

since: Calculate how many days have passed since a given date.

days since 1970-01-01

until: Calculate how many days are left until a given date.

days until 2038-01-19

count: Calculate the date N days from today.

days count 100

Features Yet to Come

The intention is to add support for natural language inputs to make it easier to use on the fly while keeping the feel of a robust CLI tool by providing consistent options for input and output formats.

Currently planned:

  • Support for automatically detecting certain date formats.
  • Support for manually specifying the date format you want to use.
  • Options to output date results in a customisable format (or choose from a list of built-in ones).
  • Options to output number-of-days results in a different unit of time (seconds, weeks, centuries).
  • Support for date-and-time inputs and outputs.
  • Support for calculating number of days between two arbitrary dates.
  • Support for referring to past and upcoming dates by their name (like "Christmas" or "next Tuesday").

Limitations

This tool is based on chrono, the excellent Rust date/time library. Note that this has some limitations when working with dates outside of the Gregorian calendar. See their limitations section for full details.

Dependencies

~2.2–3MB
~53K SLoC