Skip to content

A React component that renders content based on real-time checks of specified start and end dates.

License

Notifications You must be signed in to change notification settings

louisho5/react-period-display

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Period Display

A React component that renders content based on real-time checks of specified start and end dates. This component is useful for displaying content that should only be visible during a certain time period.

Features

  • Display content based on a start date.
  • Display content until an end date.

Installation

You can install the PeriodDisplay component via npm:

npm i react-period-display

Usage

To use the PeriodDisplay component, first import it into your React application:

import PeriodDisplay from 'react-period-display';

Next, implement the component in your application like this:

<PeriodDisplay showStart={yourStartDate} showEnd={yourEndDate}>
  Your content here
</PeriodDisplay>

Examples

Example 1: Display Content Until End Date

<PeriodDisplay showEnd={new Date('2024/10/23 17:21:20')}>
  Display content until the end date 
</PeriodDisplay>

Example 2: Display Content After Start Date

<PeriodDisplay showStart={new Date('2024/10/23 17:21')}>
  Display content after the start date
</PeriodDisplay>

Example 3: Display Content Within a Specific Period

<PeriodDisplay showStart={startDate} showEnd={endDate}>
  Display content within the period of start and end date
</PeriodDisplay>

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A React component that renders content based on real-time checks of specified start and end dates.

Resources

License

Stars

Watchers

Forks