Simple Relative Time Display Plugin with jQuery - relatime
| File Size: | 4.23 KB |
|---|---|
| Views Total: | 1030 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
Just another simple jQuery time formatting plugin used to display relative time in a human-readable format (e.g. 1 year 1 month ago, 20 hour ago, etc.).
How to use it:
1. Load jQuery JavaScript library and the jQuery Relatime plugin in the Html page.
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script src="jquery.relatime.js"></script>
2. Add the timestamp into an inline element using title attribute.
<div class="demo" title="2011-11-11 11:11:11"></div>
3. Call the plugin on the element and done.
$(".demo").jRelatime({
//OPTIONS
});
4. Call the plugin on the element and done.
$(".demo").jRelatime({
//OPTIONS
});
5. Available option to customize the time format and output messages.
printTitle: false,
multiFormat:false,
maxYear: 5,
string: {
postfix: ' ago ',
second: ' second ',
minute: ' minute ',
hour: ' hour ',
day: ' day ',
month: ' month ',
year: ' year ',
more: ' past '
}
This awesome jQuery plugin is developed by abdulhafidhk. For more Advanced Usages, please check the demo page or visit the official website.











