An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/jifalopsfrom-now)
[![Stars on vaadin.com/directory](https://img.shields.io/vaadin-directory/star/jifalopsfrom-now.svg)](https://vaadin.com/directory/component/jifalopsfrom-now)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](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)