Twix.js allows you to work with date ranges
Twix is a simple but opinionated JS library for working with date ranges, and includes a customizable smart formatter. It's written in CoffeeScript and it depends on Moment.js.
It allows you to do, among other things, this:
var t = moment"1982-01-25T09:30"twix"1982-01-25T13:30";tformat; //=> Jan 25, 1982, 9:30 AM - 1:30 PMtisSame"day"; //=> truethumanizeLength; //=> "4 hours"tcount"days"; //=> 1
And much more.
You can find comprehensive docs here:
Breaking change in 0.7.0: Twix formatting internationalization (just French, really) is no longer supported. It doesn't seem to have had a lot of use, and it's pain to maintain. Don't worry, we still support Moment's internationalized tokens.
If you want to build and test Twix for yourself,
make wraps everything you need:
|Install dependencies (same as |
|Run Mocha suite|
Patches are welcome!
developbranch. I merge develop to master when we cut a release.
.jsfiles in the patch; they're much harder to merge. I'll generate them when I cut the release.
Copyright 2012-2015 Isaac Cambron and contributors. Distributed under the MIT License. See LICENSE for details.