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/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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kahuna-base-react-components",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Kahuna Base React Components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -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() + 14 * 24 * 60 * 60 * 1000),
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 endDate = new Date(year, month, day)
115
- const startDate = new Date(year, month, day - (range - 1))
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