@shelf/datetime
v2.5.0
Published
Shelf dates library
Downloads
39,428
Maintainers
Readme
Shelf/datetime
Shelf dates library. Wrapper on dayjs with more of date-fns API
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