npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-live-clock

v6.1.25

Published

React Live Clock

Downloads

68,401

Readme

react-live-clock npm

Gitter Dependencies Dev Dependencies

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.

Demo

http://pvoznyuk.github.io/react-live-clock

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' timezone and updates every second

React Native

React Native requires that you wrap text in a <Text> like this:

import { Text, View } from "react-native";
import Clock from "react-live-clock";

export default function ClockPage() {
  return (
    <View>
      <Text>Clock page</Text>
      <Clock element={Text} />
    </View>
  );
}

If you don't you will get the error Invariant Violation: Text strings must be rendered within a <Text> component.

Formatting

you can use any formatting from moment.js date library

Properties

| Property | Type | Default Value | Description | |------------|---------------------|---------------|-------------| | date | timestamp or string | current date | Date to output, If nothing is set then it take current date. | | format | string | 'HH:MM' | Formatting from moment.js library. | locale | string | null | Changes the language of the component via prop | filter | function | (date: String) => date | Filtering the value before the output . | timezone | string | null | If timezone is set, the date is show in this timezone. You can find the list. here, the TZ column. | ticking | boolean | false | If you want the clock to be auto-updated every interval seconds. | blinking | boolean, string | false | If you want the clock's last colon to blink. Set it to all to make them all blink. | noSsr | boolean | false | Makes the component not render on the server to fix mismatch. | interval | integer | 1000 | Auto-updating period for the clock. 1 second is a default value. | className| string | null | Extra class. | style | CSSProperties | null | CSSProperties Customized inline style . | children | string | null | date can be set as a children prop. | onChange | function | ({output, previousOutput, moment}) => {} | callback function on each output update

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 [email protected]:pvoznyuk/react-live-clock.git
cd react-live-clock
npm install
npm start dev

# then
open http://localhost:8080

Tests

# to run tests
npm start test

# to generate test coverage (./reports/coverage)
npm start test.cov

# to run end-to-end tests
npm start test.e2e

License

This software is released under the MIT license. See LICENSE for more details.

Contributors