react-npm-formatted-relative-date

1.2.0 • Public • Published

react-npm-formatted-relative-date

Basic React app. This project just aim to display relative date.

npm Version Build Status

Features

  • Display Realative date.
  • Runs in the browser and Node.js.
  • Built on standards.

Example

import React,{Component} from 'react';
import ReactDOM from 'react-dom';
import FormattedRelativeDate from 'react-npm-formatted-relative-date';
 
class App extends Component {
    constructor(props){
        super(props);
    }
 
    render() {
        let myDate = new Date(2016,6,25);
        return(
            <div>
            <FormattedRelativeDate date={myDate} />
            </div>
        );
    }
}
 
ReactDOM.render(<App />,document.querySelector('.container'));
 

This example would render: relative date i.e. 3 days ago into the container element on the page.

Technology Stack:

  • react
  • mocha
  • react-intl

Usage:

Clone the repo as a new project:

git clone https://github.com/lobdev/react-npm-formatted-relative-date.git <formatted-relative-date>

Start Server:

First you have to replace the lib/component/formatted-relative-date.js to server.js in package.json
cd formatted-relative-date
npm i
npm start

Run App:

npm start command automatically initiate browser at 3000 port
http:://localhost:3000

Run tests:

cd formatted-relative-date
npm i
npm test

Developer Notes:

Make sure you configure your editor/IDE to use:

.editorconfig
.eslintrc

Readme

Keywords

Package Sidebar

Install

npm i react-npm-formatted-relative-date

Weekly Downloads

3

Version

1.2.0

License

ISC

Last publish

Collaborators

  • camstuart