@idds/react 1.5.40 → 1.5.41

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/index.es.js CHANGED
@@ -6675,23 +6675,23 @@ const TimePicker = forwardRef(
6675
6675
  }
6676
6676
  return hours * 60 + minutes;
6677
6677
  };
6678
- const isTimeDisabled = (hours, minutes, seconds, period) => {
6678
+ const isTimeDisabled = (hours, minutes, seconds, period, options = {}) => {
6679
6679
  const timeStr = formatTime(hours, minutes, seconds, period);
6680
6680
  const timeInMinutes = parseTimeToMinutes(timeStr);
6681
- if (disabledBackTime) {
6681
+ if (disabledBackTime && !options.ignoreBefore) {
6682
6682
  const now = /* @__PURE__ */ new Date();
6683
6683
  const currentTimeInMinutes = now.getHours() * 60 + now.getMinutes();
6684
6684
  if (timeInMinutes < currentTimeInMinutes) {
6685
6685
  return true;
6686
6686
  }
6687
6687
  }
6688
- if (disabledTimeBefore) {
6688
+ if (disabledTimeBefore && !options.ignoreBefore) {
6689
6689
  const beforeTimeInMinutes = parseTimeToMinutes(disabledTimeBefore);
6690
6690
  if (timeInMinutes < beforeTimeInMinutes) {
6691
6691
  return true;
6692
6692
  }
6693
6693
  }
6694
- if (disabledTimeAfter) {
6694
+ if (disabledTimeAfter && !options.ignoreAfter) {
6695
6695
  const afterTimeInMinutes = parseTimeToMinutes(disabledTimeAfter);
6696
6696
  if (timeInMinutes > afterTimeInMinutes) {
6697
6697
  return true;
@@ -6822,12 +6822,22 @@ const TimePicker = forwardRef(
6822
6822
  children: options.map((option) => {
6823
6823
  let isDisabled = false;
6824
6824
  if (type === "hour") {
6825
- isDisabled = isTimeDisabled(
6826
- use12Hours ? option === 12 ? 0 : option : option,
6827
- currentTime.minutes,
6828
- currentTime.seconds,
6829
- use12Hours ? currentTime.period : void 0
6825
+ const hourValue = use12Hours ? option === 12 ? 0 : option : option;
6826
+ const isTooEarly = isTimeDisabled(
6827
+ hourValue,
6828
+ 59,
6829
+ 59,
6830
+ use12Hours ? currentTime.period : void 0,
6831
+ { ignoreAfter: true }
6832
+ );
6833
+ const isTooLate = isTimeDisabled(
6834
+ hourValue,
6835
+ 0,
6836
+ 0,
6837
+ use12Hours ? currentTime.period : void 0,
6838
+ { ignoreBefore: true }
6830
6839
  );
6840
+ isDisabled = isTooEarly || isTooLate;
6831
6841
  } else if (type === "minute") {
6832
6842
  isDisabled = isTimeDisabled(
6833
6843
  currentTime.hours,