How to use english.tiny
lukakerr opened this issue · comments
Luka Kerr commented
I've read the docs and see theres a time style of english.tiny:
english.tiny // '1s', '2m', '3h', '4d', …
How do you use this style? I've tried:
import TimeAgo from 'javascript-time-ago';
import english from 'javascript-time-ago/locale/en';
TimeAgo.locale(english);
const timeAgo = new TimeAgo('en-US');
timeAgo.format(Date.now() - 60 * 1000, 'tiny');
but it isn't working. It just gives a long date such as: 2 hours ago
.
Luka Kerr commented
Nevermind, got it. You need to pass an object:
timeAgo.format(Date.now() - 60 * 1000, { flavour: 'tiny' });
Nikolay commented
Yeah, I updated the readme a bit describing style
https://github.com/catamphetamine/javascript-time-ago#customization
Nikolay commented
Rewrote the customization section again.