escaladesports / react-time-limit

A React component to conditionally display elements based on date/time.

Home Page:https://www.npmjs.com/package/react-time-limit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-time-limit

A React component to conditionally display elements based on date/time. Useful for displaying things like limited-time promotions so you don't have to redeploy or roll back your app on specific dates.

Installation

With Yarn:

yarn add react-time-limit

With npm:

npm install --save react-time-limit

Usage

import TimeLimit from 'react-time-limit'

...

<TimeLimit to='2018-01-20'>Show Before Target Date</TimeLimit>
<TimeLimit from='2018-01-20'>Show After Target Date</TimeLimit>
<TimeLimit from='2018-01-10' to='2018-01-15'>Show Between Two Target Dates</TimeLimit>

Dates can be supplied as any valid new Date value. (Date docs)

About

A React component to conditionally display elements based on date/time.

https://www.npmjs.com/package/react-time-limit


Languages

Language:JavaScript 100.0%