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.
- Display content based on a start date.
- Display content until an end date.
You can install the PeriodDisplay
component via npm:
npm i react-period-display
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>
<PeriodDisplay showEnd={new Date('2024/10/23 17:21:20')}>
Display content until the end date
</PeriodDisplay>
<PeriodDisplay showStart={new Date('2024/10/23 17:21')}>
Display content after the start date
</PeriodDisplay>
<PeriodDisplay showStart={startDate} showEnd={endDate}>
Display content within the period of start and end date
</PeriodDisplay>
This project is licensed under the MIT License. See the LICENSE file for details.