# twix

> Twix.js allows you to work with date ranges

Latest version **1.3.0** (published 2019-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install twix
pnpm add twix
yarn add twix
bun add twix
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2019-07-23 |
| First published | 2012-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/twix) |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Unpacked size | 147.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 377 |
| Author | Isaac Cambron |
| Maintainers | icambron |
| Keywords | twix, date, date range |

## Links

- npm: https://www.npmjs.com/package/twix
- Repository: https://github.com/icambron/twix.js
- Homepage: http://icambron.github.io/twix.js/
- Issues: https://github.com/icambron/twix.js/issues
- npm.io page: https://npm.io/package/twix

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2019-07-23
- 1.2.1 — 2017-10-02
- 1.2.0 — 2017-05-29
- 1.1.5 — 2017-04-17
- 1.1.4 — 2017-03-15
- 1.1.3 — 2016-12-09
- 1.1.2 — 2016-11-20
- 1.1.1 — 2016-08-02
- 1.1.0 — 2016-07-02
- 1.0.0 — 2016-04-26
- 0.9.0 — 2016-01-30
- 0.8.1 — 2015-11-23
- 0.8.0 — 2015-11-23
- 0.7.2 — 2015-08-23
- 0.7.1 — 2015-08-23
- … 23 more at https://npm.io/package/twix/versions

## README

# Twix.js

[![MIT License][license-image]][license] [![Build Status][travis-image]][travis-url] [![Version][release-version-image]][release-url] [![NPM version][npm-version-image]][npm-url]

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](http://momentjs.com/).

Some examples:

```js
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][documentation-url] for more.

## Documentation

You can find comprehensive docs here:

**[Detailed documentation][documentation-url]**

**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](docs/docs.md). 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][phasers-image]

[documentation-url]: https://isaaccambron.com/twix.js/docs.html

[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
[license]: LICENSE.md

[changelog]: CHANGELOG.md

[release-url]: https://github.com/icambron/twix.js/releases/latest
[release-version-image]: https://img.shields.io/github/release/icambron/twix.js.svg?style=flat-square
[npm-url]: https://npmjs.org/package/twix
[npm-version-image]: http://img.shields.io/npm/v/twix.svg?style=flat-square
[bower-version-image]: https://img.shields.io/bower/v/twix.svg?style=flat-square

[travis-url]: http://travis-ci.org/icambron/twix.js
[travis-image]: http://img.shields.io/travis/icambron/twix.js/master.svg?style=flat-square

[coveralls-url]: https://coveralls.io/github/icambron/twix.js
[coveralls-image]: https://img.shields.io/coveralls/icambron/twix.js/master.svg?style=flat-square

[gemnasium-url]: https://gemnasium.com/icambron/twix.js
[gemnasium-image]: https://img.shields.io/gemnasium/icambron/twix.js.svg?style=flat-square

[phasers-image]: https://img.shields.io/badge/phasers-stun-brightgreen.svg?style=flat-square

---
_Source: https://npm.io/package/twix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
