catamphetamine / javascript-time-ago

International highly customizable relative date/time formatting

Home Page:https://catamphetamine.gitlab.io/react-time-ago/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

twitter-style outputs year for some same-year timestamps

hossameldeen opened this issue · comments

import TimeAgo from 'javascript-time-ago';
import en from 'javascript-time-ago/locale/en';

TimeAgo.addLocale(en);
const jsTimeAgo = new TimeAgo('en-US');
console.log(jsTimeAgo.format(1555549347000, 'twitter'));

Expected: Apr 18.

Actual: Apr 18, 2019.

Note: It doesn't shows the year for all same-year dates, though. For example, it correctly doesn't show the year for Oct 18 and Oct 18.

Version: 2.0.1

Screenshot:
image

Released javascript-time-ago@2.0.3.

Thank you 👍

Haven't tried it yet, but will tell you if there's a problem.