Giter Club home page Giter Club logo

twix.js's Introduction

Twix.js

MIT License Build Status Code Coverage Code Climate Dependencies Version NPM version Bower version

Twix is a comprehensive JS library for working with date ranges, and includes a customizable smart formatter. It's written in CoffeeScript and it depends on Moment.js.

Some examples:

var t = moment("1982-01-25T09:30").twix("1982-01-25T13:30");

t.format();  //=> Jan 25, 1982, 9:30 AM - 1:30 PM

t.isSame("day"); //=> true
t.humanizeLength(); //=> "4 hours"
t.count("days"); //=> 1
t.intersection(otherRange); //=> another range

See the documentation for more.

Documentation

You can find comprehensive docs here:

Detailed documentation

Breaking change in 1.0.0: Removed the deprecated showYear and showDate smart formatter options. Use hideYear, hideDate, implicitYear, and implicitDate instead.

Building

If you want to build and test Twix for yourself, make wraps everything you need:

Command Function
make configure Install dependencies (same as npm install)
make or make build Compile src/*.coffee to dist/*.js
make test Run Mocha suite
make lint Linter
make bench Microbenchmarks

Contributing

Patches are welcome!

  • Don't include your changes to the generated .js files in the patch; they're much harder to merge. I'll generate them when I cut the release.
  • Make sure you run the linter and the tests before submitting a PR. Use make lint and make test.
  • If you make a change that will need documentation, make the appropriate update to docs. It will get published to the website on the next release.

Changelog

CHANGELOG

Copyright and License

Copyright 2012-2015 Isaac Cambron and contributors. Distributed under the MIT License. See LICENSE for details.

Phasers to stun

twix.js's People

Contributors

icambron avatar splendido avatar tkrotoff avatar leo-naeka avatar benmosher avatar ivanjov avatar nw avatar pandafulmanda avatar cwperry avatar wbercx avatar markstos avatar benesch avatar suzannehamilton avatar awirick avatar butterflyhug avatar spencern avatar tomdrn avatar andresmoschini avatar sh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.