pcm-shared-components 2.0.98 → 2.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,12 +19,18 @@ export const PricingCalendar = props => {
|
|
|
19
19
|
startDate,
|
|
20
20
|
endDate,
|
|
21
21
|
rateObject,
|
|
22
|
-
RenderDay
|
|
22
|
+
RenderDay,
|
|
23
|
+
setCurrentMonth
|
|
23
24
|
} = props;
|
|
24
25
|
const [month, setMonth] = useState(moment().toDate());
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
setMonth(moment(startDate).toDate());
|
|
27
28
|
}, [startDate]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (setCurrentMonth) {
|
|
31
|
+
setMonth(moment(setCurrentMonth).toDate());
|
|
32
|
+
}
|
|
33
|
+
}, [setCurrentMonth]);
|
|
28
34
|
const DefaultRenderDayComponent = ({
|
|
29
35
|
date,
|
|
30
36
|
foundRate
|
|
@@ -63,7 +69,7 @@ export const PricingCalendar = props => {
|
|
|
63
69
|
}
|
|
64
70
|
const handleDayRender = ({
|
|
65
71
|
date
|
|
66
|
-
}) => {
|
|
72
|
+
}, ...props) => {
|
|
67
73
|
// const foundRate = rateObject.find((item)=> moment(date).isSame(item.date, "day") );
|
|
68
74
|
const foundRate = findObjectByDate(rateObject, moment(date).format('YYYY-MM-DD'));
|
|
69
75
|
if (foundRate && RenderDay) {
|
|
@@ -99,9 +105,12 @@ PricingCalendar.defaultProps = {
|
|
|
99
105
|
rateObject: [],
|
|
100
106
|
startDate: moment(),
|
|
101
107
|
endDate: moment().add(1, 'days'),
|
|
102
|
-
i18next: undefined
|
|
108
|
+
i18next: undefined,
|
|
109
|
+
setCurrentMonth: moment().toDate()
|
|
103
110
|
};
|
|
104
111
|
PricingCalendar.propTypes = {
|
|
112
|
+
/** The current month to display */
|
|
113
|
+
setCurrentMonth: PropTypes.instanceOf(Date),
|
|
105
114
|
/** The component to render the day, receives one prop date and the rateObject if a match was found*/
|
|
106
115
|
RenderDay: PropTypes.elementType,
|
|
107
116
|
/** The daily rate object */
|