kahuna-base-react-components 1.4.2 → 1.4.3
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.
- package/dist/components/KSelectRangeDate/KSelectRangeDate.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/KSelectRangeDate/KSelectRangeDate.stories.tsx +3 -1
- package/src/components/KSelectRangeDate/KSelectRangeDate.tsx +6 -2
package/dist/types.d.ts
CHANGED
|
@@ -347,6 +347,7 @@ interface KSelectRangeDateProps {
|
|
|
347
347
|
popupCalendarBackground?: string;
|
|
348
348
|
hideBackdrop?: boolean;
|
|
349
349
|
weeklyMode?: boolean;
|
|
350
|
+
shorthandEndDateOffsetDays?: number;
|
|
350
351
|
}
|
|
351
352
|
type DateRangeType = Date | null | [Date | null, Date | null];
|
|
352
353
|
declare const KSelectRangeDate: React.FC<KSelectRangeDateProps>;
|
package/package.json
CHANGED
|
@@ -71,6 +71,7 @@ KSelectRangePrimary.args = {
|
|
|
71
71
|
align: "center",
|
|
72
72
|
hideBackdrop: true,
|
|
73
73
|
anchorToButton: true,
|
|
74
|
+
shorthandEndDateOffsetDays: 5,
|
|
74
75
|
|
|
75
76
|
onChange: (value) => {
|
|
76
77
|
if (value) {
|
|
@@ -113,7 +114,8 @@ KSelectRangeDateMinimumDate.args = {
|
|
|
113
114
|
anchorToButton: true,
|
|
114
115
|
position: "top",
|
|
115
116
|
align: "center",
|
|
116
|
-
minimumDate: new Date(new Date().getTime()
|
|
117
|
+
minimumDate: new Date(new Date().getTime() - 2 * 24 * 60 * 60 * 1000),
|
|
118
|
+
maximumDate: new Date(new Date().getTime() - 2 * 24 * 60 * 60 * 1000),
|
|
117
119
|
|
|
118
120
|
onChange: (value) => {
|
|
119
121
|
if (value) {
|
|
@@ -32,6 +32,7 @@ export interface KSelectRangeDateProps {
|
|
|
32
32
|
popupCalendarBackground?: string
|
|
33
33
|
hideBackdrop?: boolean
|
|
34
34
|
weeklyMode?: boolean
|
|
35
|
+
shorthandEndDateOffsetDays?: number
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export type DateRangeType = Date | null | [Date | null, Date | null]
|
|
@@ -111,8 +112,11 @@ const KSelectRangeDate: React.FC<KSelectRangeDateProps> = (props) => {
|
|
|
111
112
|
const month = theDate.getMonth()
|
|
112
113
|
const day = theDate.getDate()
|
|
113
114
|
|
|
114
|
-
const
|
|
115
|
-
|
|
115
|
+
const delta = props.shorthandEndDateOffsetDays ?? 0
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const endDate = new Date(year, month, day - delta)
|
|
119
|
+
const startDate = new Date(year, month, day - delta - (range - 1))
|
|
116
120
|
setRange([startDate, endDate])
|
|
117
121
|
}
|
|
118
122
|
|