hustcc / timeago.js

:clock8: :hourglass: timeago.js is a tiny(2.0 kb) library used to format date with `*** time ago` statement.
https://timeago.org
MIT License
5.32k stars 410 forks source link

Add possibility to change suffix / prefix like "ago" and "in" #242

Open kulla opened 3 years ago

kulla commented 3 years ago

First of all: Thanks for this library (as well as for https://github.com/hustcc/timeago-react ). :heart: We can successfully use them in our NGO.

My feature request / question: I wanted to use this library to display a message like At this site since 2 days / 3 weeks / 1 year .... However, when I use https://github.com/hustcc/timeago-react there is always the suffix / prefix "ago" or "in". Here is an example, how I wanted to use it with the "unwanted" ago:

2021-04-16-120819_852x321_scrot

Thus: Is there a way to get the timeago string without the "ago" suffix / "in" prefix? https://www.npmjs.com/package/react-timeago has the option formatter with which a own formatter can be specified. Is there a similar way here?

Note: I know that a simple workaround is to change the sentence to something like Registered 2 days ago / 3 weeks ago / 1 year ago .... However in this case we want to empathize the time duration somebody voluntarily works at our site and not the event of the registration itself. So the sentence with since would be better.

hustcc commented 3 years ago

use registeLocale