1.0.0 • Published 3 years ago

react-live-clock-date-fns v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

react-live-clock-date-fns

Installation

NPM

npm install --save react react-live-clock-date-fns

Usage

import React  from 'react';
import Clock from 'react-live-clock-date-fns';

exports default function MyComponent() {
    return <Clock />
}

Outputs:

<time>10:15:34</time>

** Shows current time using new Date() constructor and updates every second

Formatting

you can use any formatting from date-fns date library

Properties

PropertieTypeDefault ValueDescription
formatstring'h:mm:ss a, MMMM do yyyy'Formatting from date-fns library.
intervalinteger1000Auto-updating period for the clock. 1 second is a default value.
classNamestringnullExtra class.
styleobjectnullExtra styles.

Development and testing

Currently is being developed and tested with the latest stable Node 14 on Linux.

To run example, useyarn start, which will start development project

git clone https://github.com/SandunRathsara/react-live-clock-date-fns.git
cd react-live-clock-date-fns
yarn install
yarn start

# then
open http://localhost:3000

License

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

Contributors