next-helios-fe 1.8.93 → 1.8.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-helios-fe",
3
- "version": "1.8.93",
3
+ "version": "1.8.94",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,13 +2,13 @@
2
2
  import React from "react";
3
3
  import Cl from "react-calendar";
4
4
  import "../../../styles";
5
- import dayjs from "dayjs";
5
+ import dayjs, { Dayjs } from "dayjs";
6
6
 
7
7
  interface CalendarProps {
8
8
  options?: {
9
9
  enableSelectRange?: boolean;
10
- disablePast?: boolean;
11
- disableFuture?: boolean;
10
+ minDate?: Dayjs;
11
+ maxDate?: Dayjs;
12
12
  };
13
13
  value?: any;
14
14
  onChange?: (date: any) => void;
@@ -23,10 +23,14 @@ export const Calendar: React.FC<CalendarProps> = ({
23
23
  <Cl
24
24
  selectRange={options?.enableSelectRange ?? false}
25
25
  minDate={
26
- options?.disablePast ? dayjs().startOf("day").toDate() : undefined
26
+ options?.minDate
27
+ ? dayjs(options?.minDate).startOf("day").toDate()
28
+ : undefined
27
29
  }
28
30
  maxDate={
29
- options?.disableFuture ? dayjs().endOf("day").toDate() : undefined
31
+ options?.maxDate
32
+ ? dayjs(options?.maxDate).startOf("day").toDate()
33
+ : undefined
30
34
  }
31
35
  value={value}
32
36
  onChange={onChange}
@@ -2,7 +2,7 @@
2
2
  import React, { useState, useEffect, useRef } from "react";
3
3
  import { Tooltip, Dropdown, Calendar } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
- import dayjs from "dayjs";
5
+ import dayjs, { Dayjs } from "dayjs";
6
6
 
7
7
  export interface DateProps extends React.InputHTMLAttributes<HTMLInputElement> {
8
8
  label?: string;
@@ -10,6 +10,8 @@ export interface DateProps extends React.InputHTMLAttributes<HTMLInputElement> {
10
10
  options?: {
11
11
  buttonOnly?: boolean;
12
12
  enableSelectRange?: boolean;
13
+ minDate?: Dayjs;
14
+ maxDate?: Dayjs;
13
15
  disablePast?: boolean;
14
16
  disableFuture?: boolean;
15
17
  width?: "full" | "fit";
@@ -284,8 +286,14 @@ export const Date: React.FC<DateProps> = ({
284
286
  <Calendar
285
287
  options={{
286
288
  enableSelectRange: options?.enableSelectRange ?? false,
287
- disablePast: options?.disablePast ?? false,
288
- disableFuture: options?.disableFuture ?? false,
289
+ minDate:
290
+ options?.minDate ?? options?.disablePast
291
+ ? dayjs()
292
+ : undefined,
293
+ maxDate:
294
+ options?.maxDate ?? options?.disableFuture
295
+ ? dayjs()
296
+ : undefined,
289
297
  }}
290
298
  value={options?.enableSelectRange ? tempValue : tempValue[0]}
291
299
  onChange={(value) => {