#time #calc #parser

kairos

A library on top of chrono to calculate times and dates ergonomically

6 releases

0.2.0 May 28, 2018
0.1.1 May 28, 2018
0.1.0 Feb 5, 2018
0.1.0-beta-2 Nov 24, 2017
0.0.0 Sep 2, 2017

#11 in Date and time

Download history 99/week @ 2018-05-05 62/week @ 2018-05-12 1/week @ 2018-05-19 14/week @ 2018-05-26 48/week @ 2018-06-02 13/week @ 2018-06-09 100/week @ 2018-06-16 29/week @ 2018-06-23 71/week @ 2018-06-30 19/week @ 2018-07-07 16/week @ 2018-07-14 139/week @ 2018-07-21 36/week @ 2018-07-28

339 downloads per month

Kairos

Calculate times with chrono "plain text like" in Rust.

Build Status license Tokei

From Wikipedia:

Kairos (καιρός) is an Ancient Greek word meaning the right, critical or opportune moment.

This library offers an abstraction over the awesome chrono crate to calculate dates almost like one would write plain text:

use kairos::timetype::TimeType as TT;

// get the end of the month of the day 5 days ago
let _ = (TT::today() - TT::weeks(1) + TT::days(2)).end_of_month();

// alternative to above
let _ = (TT::today() - TT::days(5)).end_of_month();

// NOTE: The following features are not yet included

// get a vector of dates for the next 4 weeks, starting today
let _ = TT::today()
    .every(TT::week(1))
    .take(4);

// get an iterator of dates for the next year, in a weekly fashion, starting
// today but skipping october
let _ = TT::today()
    .every(TT::week(1))
    .skip(Month::October)
    .until(Mark::END_OF_YEAR);

// and finally, a complex one

let _ = (TT::today() - TT::years(1))       // exactly one year ago
  .every(Day::Monday)                      // and then every Monday
  .skip(Month::October)                    // but not in october
  .skip(|date| date.is(Mark::MONTH_START)) // and not if the day is the 1st of a month
  .until(Mark::Moment(today()));           // until today

Parsing User-Input

kairos ships a user input parser, so you can include kairos in your commandline applications.

Have a look at the example CLI utility or the language documentation.

Vacation notice

Notice: I, the author of kairos, will be on vacation from mid-May 2018 until early 2019. I hope I can continue develop kairos during that time, but I cannot guarantee that. I hope I can continue development of kairos after that and I certainly plan to do so.

@TheNeikos as commit rights to this repository and will respond to issues and PRs.

License

MPL 2.0

MPL-2.0 license

Dependencies

Reverse deps