Open shalineepatel opened 3 weeks ago
With the v2.0.1, it added date-fns chunk which wasn't in there before with react-date-range v1.4.0
We have a 'DatePickerRange' implemented in our project as below
import "react-date-range/dist/styles.css"; // main css file import "react-date-range/dist/theme/default.css"; // theme css file import { DateRangePicker, defaultInputRanges, defaultStaticRanges } from "react-date-range"; const DateFilter: React.FC = () => { const [state, setState] = React.useState([ { startDate: null, endDate: null, key: "selection" } ]); return ( <DateRangePicker style={{ minHeight: 270 }} direction="horizontal" showSelectionPreview={true} dateDisplayFormat={"dd MMM yyyy"} months={2} weekStartsOn={1} rangeColors={["rgb(104, 54, 139)"]} onChange={(item: any) => setState([ { startDate: item.range1.startDate, endDate: item.range1.endDate } ]) } ranges={[ { startDate: state[0].startDate, endDate: state[0].endDate } ]} inputRanges={[defaultInputRanges[0]]} staticRanges={[ { ...defaultStaticRanges[2], range: () => ({ startDate: startOfISOWeek(new Date()), endDate: new Date() }) }, { ...defaultStaticRanges[3], range: () => ({ startDate: startOfISOWeek(addDays(new Date(), -7)), endDate: endOfISOWeek(addDays(new Date(), -7)) }) } ]} /> ); };
It shouldn't include the date-fns chunk as before, or only the imports from the components used in the project. Right now it imports everything. (See the attached file)
Package Version: 2.0.1 React version: 18.2.0 Node version: 18.12.1 Browser: Google Chrome
The bundle size of the project has increased after the upgrade
With the v2.0.1, it added date-fns chunk which wasn't in there before with react-date-range v1.4.0
We have a 'DatePickerRange' implemented in our project as below
import "react-date-range/dist/styles.css"; // main css file import "react-date-range/dist/theme/default.css"; // theme css file import { DateRangePicker, defaultInputRanges, defaultStaticRanges } from "react-date-range"; const DateFilter: React.FC = () => { const [state, setState] = React.useState([
{
startDate: null,
endDate: null,
key: "selection"
}
]);
return (
<DateRangePicker
style={{ minHeight: 270 }}
direction="horizontal"
showSelectionPreview={true}
dateDisplayFormat={"dd MMM yyyy"}
months={2}
weekStartsOn={1}
rangeColors={["rgb(104, 54, 139)"]}
onChange={(item: any) =>
setState([
{
startDate: item.range1.startDate,
endDate: item.range1.endDate
}
])
}
ranges={[
{ startDate: state[0].startDate, endDate: state[0].endDate }
]}
inputRanges={[defaultInputRanges[0]]}
staticRanges={[
{
...defaultStaticRanges[2],
range: () => ({
startDate: startOfISOWeek(new Date()),
endDate: new Date()
})
},
{
...defaultStaticRanges[3],
range: () => ({
startDate: startOfISOWeek(addDays(new Date(), -7)),
endDate: endOfISOWeek(addDays(new Date(), -7))
})
}
]}
/>
);
};
[BUG] Expected behavior
It shouldn't include the date-fns chunk as before, or only the imports from the components used in the project. Right now it imports everything. (See the attached file)
Environment
Package Version: 2.0.1 React version: 18.2.0 Node version: 18.12.1 Browser: Google Chrome