0.2.0 • Published 7 months ago

chronosis v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Downloads per month npm package minimized gzipped size (select exports)

!WARNING
Chronosis is currently in BETA. Expect frequent breaking changes as the API and codebase matures.

The fastest and smallest date manipulation library.

  • Tiny: Gzips to less than 1 kilobyte, comparable to the size of only date-fns's add function. That's ~3x smaller than dayjs and ~22x smaller than luxon!
  • Simple: Only includes necessary functions for manipulation and formatting, excluding excess like equality comparisons.
  • Absurdly fast: Significantly faster at nearly every single common action than any other similar package.
  • I18N: Implements Intl.DateTimeFormat to translate language-specific terms via the browser.

Installation

To install, use your preferred package manager to download chronosis.

npm install chronosis

chronosis is developed on Linux, using bun.sh as package manager, script runner, bundler, and test runner. Certain parts of the project may work on Windows, but it is highly suggested to install WSL and continue from there.

Once complete, just import the Chronosis class into your code, and start programming!

Usage

Manipulating dates and times should be simple, so Chronosis makes it easy.

import { Chronosis } from 'chronosis'

const now = new Chronosis()

// Familiar, chainable syntax
const noon_tomorrow = now.add(1, 'day').set('hour', 11).startOf('hour')

// Intuitive, internationalized formatting
console.log(noon_tomorrow.format('dddd, MMMM D, YYYY', 'es-MX'))
// Logs something like 'sábado, septiembre 9, 2023'

For more detailed information and documentation, see chronosis.js.org.

Examples

Find how many days are left in the month

const now = new Chronosis()
const end_of_month = now.endOf('month')

const days_left = end_of_month.get('day') - now.get('day')

Contributing

Please see CONTRIBUTING.md to see how best to contribute to this project.

0.2.0

7 months ago

0.1.1

8 months ago

0.1.0

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago