Author: | Tokinx |
---|---|
Views Total: | 153 views |
Official Page: | Go to website |
Last Update: | May 2, 2022 |
License: | MIT |
Preview:

Description:
Lately.js is a super tiny (~ 1kb) and blazing fast timeago library that automatically shortens the Datetime (ISO 8601) into relative time (how long ago).
How to use it:
1. Load the minified version of the Lately.js library in the document.
<script src="lately.js"></script>
2. Add your Datetime string (ISO 8601) to the page.
// time tag <time class="lately" datetime="2016-09-28T23:49:41+00:00" itemprop="datePublished" pubdate>2016-September-28</time> // title attribute <a href="#" class="lately" title="2020-02-14 18:56">Any string</a> // OR any container element <a href="#" class="lately">2021-02-12 21:39</a>
3. Initialize the Lately.js. That’s it.
window.Lately && Lately.init({ target: '.lately' });
4. Localize the Lately.js library.
window.Lately && Lately.init({ target: '.lately', lang: { 'second': ' Second', 'minute': ' Minute', 'hour': ' Hour', 'day': ' Days', 'month': ' Month', 'year': ' Years', 'ago': ' Ago', 'error': 'NaN' } });