https://github.com/shelfio/datetime
Shelf dates library
https://github.com/shelfio/datetime
core-i npm npm-package
Last synced: 4 months ago
JSON representation
Shelf dates library
- Host: GitHub
- URL: https://github.com/shelfio/datetime
- Owner: shelfio
- License: mit
- Created: 2022-11-02T12:57:04.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-08-31T11:54:53.000Z (4 months ago)
- Last Synced: 2025-08-31T13:26:05.391Z (4 months ago)
- Topics: core-i, npm, npm-package
- Language: TypeScript
- Homepage:
- Size: 883 KB
- Stars: 1
- Watchers: 16
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: license
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Shelf/datetime [](https://app.circleci.com/pipelines/github/shelfio/datetime)
> Shelf dates library. Wrapper on [dayjs](https://day.js.org/) with more of date-fns API
## Install
```
$ yarn add @shelf/datetime
```
## Usage
```js
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
```sh
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
```
## License
MIT © [Shelf](https://shelf.io)