
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-date-range-divider
Advanced tools
[](https://badge.fury.io/js/react-date-range-divider)
A react component for divide a date interval into equally distributited intervals at a day level.
npm i react-date-range-divider --save
import { DateRangeDivider, IMiddleDateInterval } from 'react-date-range-divider';
const FooComponent = () => {
const [intervals, setIntervals] = useState<IMiddleDateInterval[]>([]);
const numOfDivisios = 2;
const startDate = new Date("2020/05/11"); // YYYY/MM/DD
const endDate = new Date("2020/05/15"); // YYYY/MM/DD
return (
<DateRangeDivider
divisions={numOfDivisios}
startDate={startDate}
endDate={endDate}
onDivisionsChange={(resultIntervals: IMiddleDateInterval[]) => {
// Do what you need with intervals
setIntervals(() => resultIntervals);
}}
/>
)
};
Since it divides in entire days a non possible Int division (with no decimals in result) will aproximate the first interval to the next day. In this case the result will be:
5 days in total from 11/05/2020 - 15/05/2020. (DD/MM/YYYY)
If only need to divide intervals without the component, the function can be imported alone.
import { calcRegularIntervals, IMiddleDateInterval } from 'react-date-range-divider';
const startDate = new Date("2020/05/11"); // YYYY/MM/DD
const endDate = new Date("2020/05/15"); // YYYY/MM/DD
const numOfDivisios = 2;
const intervals: IMiddleDateInterval[] = calcRegularIntervals(startDate, endDate, numOfDivisios); // number to divide is 1 by default
import { DateRangeDivider } from 'react-date-range-divider';
By passing a endDate lower than the startDate or giving a divisionNumber higher than the number of days in between parent interval, the component will use the current day divided in one
| Name | Type | Description |
|---|---|---|
| divisions | number | Number of division desired of the given period (If this number is higher than the number of days available in the period will take 1 as default) |
| startDate | Date | Start date of the parent interval (will convert to the beggining of the passes day. ex: 2020/05/14:12:14:00 => 2020/05/14-00:00:00) |
| endDate | Date | Finish Date of the parent interval (will convert to the beggining of the passes day. ex: 2020/05/14:12:14:00 => 2020/05/14-23:59:59) |
| onDivisionsChange | (intervals: IMiddleDateInterval[]) => void | callback that passes the resultant intervals as argument |
| Name | Type | Description |
|---|---|---|
| IMiddleDateInterval | {start: Date, end: Date} | Dates resultant of division calculus |
FAQs
[](https://badge.fury.io/js/react-date-range-divider)
The npm package react-date-range-divider receives a total of 0 weekly downloads. As such, react-date-range-divider popularity was classified as not popular.
We found that react-date-range-divider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.