https://github.com/jifalops/from-now
A polymer element that strategically updates a time from (or to) now using Momentjs.
https://github.com/jifalops/from-now
momentjs polymer-element
Last synced: 5 months ago
JSON representation
A polymer element that strategically updates a time from (or to) now using Momentjs.
- Host: GitHub
- URL: https://github.com/jifalops/from-now
- Owner: jifalops
- License: mit
- Created: 2016-10-28T02:53:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-31T03:40:33.000Z (almost 8 years ago)
- Last Synced: 2025-11-05T08:15:30.284Z (8 months ago)
- Topics: momentjs, polymer-element
- Language: HTML
- Size: 3.88 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://vaadin.com/directory/component/jifalopsfrom-now)
[](https://vaadin.com/directory/component/jifalopsfrom-now)
[](https://www.webcomponents.org/element/jifalops/from-now)
# from-now
A polymer element that strategically updates its output based on the age of
`time`. The default output is the relative time (e.g. 8 hours ago).
## Installation
```
bower i -S jifalops/from-now # Polymer 2.0 class based
bower i -S jifalops/from-now#0.4.0 # Polymer 2.0 hybrid (1.x compatible)
bower i -S jifalops/from-now#0.3.0 # Polymer 1.x based
```
## Usage
Simply give it a timestamp including milliseconds and it will output time
relative to now in a human friendly format. It will also update the output
according to how far away it is (e.g. once per day/hour/minute).
## Demo
```html
| default
| idle
| absolute
| formatted absolute
(mouseover for alternate format)
```
Full demo:
[webcomponents.org](https://www.webcomponents.org/element/jifalops/from-now/demo/demo/index.html)
| [github](https://jifalops.github.io/from-now/components/from-now/demo/)
API: [webcomponents.org](https://www.webcomponents.org/element/jifalops/from-now/from-now)
## Contributing
1. Fork it on Github.
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request
## License
[MIT](https://opensource.org/licenses/MIT)