https://github.com/mikepenzin/timeago-simple
timeago makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "1 day ago")
https://github.com/mikepenzin/timeago-simple
bower date nodejs-modules nodejs-plugin npm-module npm-package npm-scripts parser timeago vanilla-javascript vanilla-js
Last synced: 4 months ago
JSON representation
timeago makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "1 day ago")
- Host: GitHub
- URL: https://github.com/mikepenzin/timeago-simple
- Owner: mikepenzin
- Created: 2017-03-21T17:18:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-18T08:27:09.000Z (almost 8 years ago)
- Last Synced: 2026-01-14T08:41:28.196Z (5 months ago)
- Topics: bower, date, nodejs-modules, nodejs-plugin, npm-module, npm-package, npm-scripts, parser, timeago, vanilla-javascript, vanilla-js
- Language: JavaScript
- Homepage:
- Size: 52.7 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# timeago-simple
[]() []() []() []() []()
Timeago is a simple plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "1 day ago")
[](https://nodei.co/npm/timeago-simple/)
## NodeJS Plugin
Install:
```js
npm install timeago-simple --save
```
Usage:
```js
var timeago = require("timeago-simple");
var timeStamp = 'Tue Mar 21 2017 15:08:46 GMT+0000 (UTC)';
var newTime = timeago.simple(timeStamp);
// 9 hours ago
var futureTimeStamp = 'Tue Mar 21 2019 15:08:46 GMT+0000 (UTC)';
var newFutureTime = timeago.simple(futureTimeStamp);
// in 2 years
```
## Bower (plain JavaScript)
Add via Bower:
```js
bower install timeago-simple --save
```
Add via CDN:
```html
```
#### Directory for legasy versions
https://cdn.jsdelivr.net/npm/timeago-simple@1.2.2/
#### Usage:
```html
Posted: Tue Mar 21 2017 15:08:46 GMT+0000 (UTC)
Posted: Tue Apr 2 2017
Posted: 12/31/2004
Posted: 2017/03/31
Will be ready Tue Mar 21 2020 15:08:46 GMT+0000 (UTC)
Will be ready 06/31/2017
```
#### Troubleshooting:
If we unable to parse the date and time error message will throw in console and original data will display
```html
Posted: 31/12/2004
Posted: 4366325635463456
Posted: zcbdsdewea
```
## Tests
`npm run cover`
## Contributing
In lieu of a formal style guide, take care to maintain the existing coding style.
Add unit tests for any new or changed functionality. Lint and test your code.
## Release Notes
#### v.1.2.4
- Merged past and future time calculation.
- Depricated future calculation, use only simple function call.
#### v.1.2.3
- Add CDN links
#### v.1.2.2
- Add functionality for "future" date calculation.
#### v.1.1.1
- Add troubleshooting for wrong date format.
#### v.1.1.2
- Add seconds display functionality.