JSPM

  • Created
  • Published
  • Downloads 2256
  • Score
    100M100P100Q116340F
  • License MIT

Shelf dates library

Package Exports

  • @shelf/datetime
  • @shelf/datetime/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shelf/datetime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Shelf/datetime CircleCI

Shelf dates library

Install

$ yarn add @shelf/datetime

Usage

import {setGlobalLocale, formatDistance} from '@shelf/datetime';
// OR
import setGlobalLocale from '@shelf/datetime/lib/setGlobaleLocale';
import formatDistance from '@shelf/datetime/lib/formatDistance';

setGlobalLocale('uk'); // set non-default locale (default 'en')

formatDistance(new Date(1986, 3, 4, 10, 32, 0), new Date(1986, 3, 4, 10, 32, 20));

setGlobalLocale('en');

formatDistance(new Date(1986, 3, 4, 10, 32, 0), new Date(1986, 3, 4, 10, 32, 20)); // a few seconds ago

Publish

$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags

License

MIT © Shelf