Package Exports
- dayjs-twitter
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 (dayjs-twitter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
dayjs-twitter 
dayjs-twitter is a plugin to day.js that formats dates like Twitter
Installation
NPM
npm install dayjs-twitter
import dayjs from 'dayjs'
import dayjsTwitter from 'dayjs-twitter'
dayjs.extend(dayjsTwitter)
CDN
<script src="https://unpkg.com/dayjs"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs-twitter/dist/dayjs-twitter.min.js"></script>
<script>
dayjs.extend(dayjsTwitter.default)
</script>
Usage
dayjs().twitter() // => 'Now'
dayjs().subtract(10, 'second').twitter() // => '10s'
dayjs().subtract(1, 'minute').twitter() // => '1m'
dayjs().subtract(23, 'hour').twitter() // => '23h'
dayjs().subtract(1, 'day').twitter() // => 'Aug 28'
dayjs().subtract(1, 'year').twitter() // => 'Aug 28, 2018'
Localization
dayjs.locale('es')
dayjs().twitter() // => 'Ahora'
dayjs().subtract(10, 'second').twitter() // => '10s'
dayjs().subtract(1, 'minute').twitter() // => '1min'
dayjs().subtract(23, 'hour').twitter() // => '23h'
dayjs().subtract(1, 'day').twitter() // => '28 aug.'
dayjs().subtract(1, 'year').twitter() // => '28 aug. 2018'
The list of all currently available translations can be found in the src/locale.
Testing
npm test
Contribution
If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.