Relative Timestamps Update Plugin - timeago

File Size: 67.6 KB
Views Total: 10116
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Relative Timestamps Update Plugin - timeago

timeago is a smart and useful jQuery Plugin for updating fuzzy timestamps in your document automatically and intelligently. It supports almost all the major languages.

The vanilla JavaScript version is now available.

For Example:

  • You opened this page x minutes ago. 
  • This page was last modified x months ago.
  • Ryan was born xx years ago.
  • ...

You might also like:

Basic Usage:

1. Include jQuery library and jQuery timeago plugin on your page

<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.timeago.js" type="text/javascript"></script>

2.  Add a date timestamp in ISO 8601 format

<abbr class="timeago" title="2013-04-01T06:24:17Z">December 17, 2011</abbr>
<time class="timeago" datetime="2013-04-01T06:24:17Z">December 17, 2011</time>

3. Call the plugin

<script type="text/javascript">
   jQuery(document).ready(function() {
     $("abbr.timeago").timeago();
   });
</script>

4. Optional settings.

refreshMillis: 60000,
allowPast: true,
allowFuture: false,
localeTitle: false,
cutoff: 0,
autoDispose: true,
strings: {
  prefixAgo: null,
  prefixFromNow: null,
  suffixAgo: "ago",
  suffixFromNow: "from now",
  inPast: 'any moment now',
  seconds: "less than a minute",
  minute: "about a minute",
  minutes: "%d minutes",
  hour: "about an hour",
  hours: "about %d hours",
  day: "a day",
  days: "%d days",
  month: "about a month",
  months: "%d months",
  year: "about a year",
  years: "%d years",
  wordSeparator: " ",
  numbers: []
}

Changelog:

v1.6.7 (2019-04-24)

  • Extend jQuery dependency to >=1.5.0 <4.0

v1.6.6 (2019-04-13)

  • Fixed for jQuery 3.4

v1.6.5 (2019-02-25)

  • locale improvements

v1.6.4 (2019-02-01)

  • locale improvements

v1.6.3 (2018-02-24)

  • Wraped locales in UMD wrappers; locale improvements

v1.6.1 (2017-07-18)

  • fix paren mismatch in umd wrapper

v1.6.0 (2017-07-15)

  • Wraped locales in UMD wrappers

v1.5.4 (2017-01-20)

  • update and bugfix

v1.5.3 (2016-06-25)

  • update and bugfix

v1.5.2 (2016-02-13)

  • update

v1.5.1 (2016-02-04)

  • update

v1.5.0 (2016-01-22)

  • update

v1.4.3 (2015-09-19)

  • update

v1.4.2 (2015-08-29)

  • update

v1.4.1 (2014-05-02)

  • Added allowPast setting

v1.4.0 (2014-03-03)

  • Added updateFromDOM function; bug fixes; bower support

v1.3.2 (2014-02-28)

  • update.

v1.3.1 (2013-12-27)

  • Added support for 2-digit time zone designators

v1.3.0 (2013-06-17)

  • Added updateFromDOM function

v1.2.0 (2013-05-19)

  • Added cutoff setting

 


This awesome jQuery plugin is developed by rmm5t. For more Advanced Usages, please check the demo page or visit the official website.