react-live-clock
React clock with time-zones
DEMO
Installation
NPM
npm install --save react react-live-clock
Don't forget to manually install peer dependencies (react
) if you use npm@3.
Bower:
bower install --save https://unpkg.com/react-live-clock/bower.zip
Demo
http://pvoznyuk.github.io/react-live-clock
Codepen demo
Usage
import React from 'react';
import Clock from 'react-live-clock';
exports default class MyComponent extends React.Component {
render() {
<Clock format={'HH:mm:ss'} ticking={true} timezone={'US/Pacific'} />
}
}
Outputs:
<time>10:15:34</time>
** Shows current time for 'US/Pacific' timezine and updats every second
Formatting
import React from 'react';
import Clock from 'react-live-clock';
exports default class MyComponent extends React.Component {
render() {
<Clock format="YYYY/MM/DD">1976-04-19T12:59-0500</Clock>
}
}
Outputs:
<time>1976/04/19</time>
** you can use any formatting from node-dateformat date library
Development and testing
Currently is being developed and tested with the latest stable Node 7
on OSX
and Windows
.
To run example covering all ReactLiveClock
features, use npm start dev
, which will compile src/example/Example.js
git clone git@github.com:pvoznyuk/react-live-clock.git
cd react-live-clock
npm install
npm start dev
open http://localhost:8080
Tests
npm start test
npm start test.cov
npm start test.e2e
License
This software is released under the MIT license. See LICENSE for more details.
Contributors