rmm5t / jquery-timeago

:clock8: The original jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago").
http://timeago.yarp.com
MIT License
3.82k stars 710 forks source link

Add setting to pass options for date.toLocaleString() #356

Open ghost opened 5 years ago

ghost commented 5 years ago

I personally don't like the format that toLocaleString() returns (24/10/2019 2:36:56).

It would be nice if there was an option to pass its options like dateStyle: 'long', timeStyle: 'short', etc.

e.g.

$.timeago.settings.LocaleFormat = {dateStyle: 'medium', timeStyle: 'short', hour12: true};
// $(this).attr("title", date.toLocaleString(undefined, $t.settings.LocaleFormat));

will show as Oct 8, 2019, 2:36 AM