pcm-shared-components 2.0.98 → 2.0.99
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,8 @@ export const PricingCalendar = props => {
|
|
|
63
69
|
}
|
|
64
70
|
const handleDayRender = ({
|
|
65
71
|
date
|
|
66
|
-
}) => {
|
|
72
|
+
}, ...props) => {
|
|
73
|
+
console.log(props);
|
|
67
74
|
// const foundRate = rateObject.find((item)=> moment(date).isSame(item.date, "day") );
|
|
68
75
|
const foundRate = findObjectByDate(rateObject, moment(date).format('YYYY-MM-DD'));
|
|
69
76
|
if (foundRate && RenderDay) {
|
|
@@ -99,9 +106,12 @@ PricingCalendar.defaultProps = {
|
|
|
99
106
|
rateObject: [],
|
|
100
107
|
startDate: moment(),
|
|
101
108
|
endDate: moment().add(1, 'days'),
|
|
102
|
-
i18next: undefined
|
|
109
|
+
i18next: undefined,
|
|
110
|
+
setCurrentMonth: moment().toDate()
|
|
103
111
|
};
|
|
104
112
|
PricingCalendar.propTypes = {
|
|
113
|
+
/** The current month to display */
|
|
114
|
+
setCurrentMonth: PropTypes.instanceOf(Date),
|
|
105
115
|
/** The component to render the day, receives one prop date and the rateObject if a match was found*/
|
|
106
116
|
RenderDay: PropTypes.elementType,
|
|
107
117
|
/** The daily rate object */
|