twix

1.3.0last stable release 6 years ago
Complexity Score
Low
Open Issues
N/A
Dependent Projects
34
Weekly Downloadsglobal
46,601

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Loading Weekly Download Data

Readme

Twix.js

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.

Dependencies

Loading dependencies...

CVE IssuesActive
0
Scorecards Score
1.90
Test Coverage
No Data
Follows Semver
Yes
Github Stars
379
Dependenciestotal
10
DependenciesOutdated
0
DependenciesDeprecated
1
Threat Modelling
No Data
Repo Audits
No Data

Learn how to distribute twix in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install twix
Processing...
Done

38 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.