Skip to content

Commit

Permalink
fix(mis): 修改了白名单添加过期时间的逻辑 (#1274)
Browse files Browse the repository at this point in the history
  • Loading branch information
usaveh authored May 29, 2024
1 parent a50d5ce commit f0b3162
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-brooms-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/mis-web": patch
---

将白名单过期时间选择的最小日期调整至+1 天,将所选择日期的时分秒调整至 24:00:00(00:00:00).
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const PickExpDate: React.FC<PickExpDateProps> = (props) => {
const dateFormat = "YYYY-MM-DD";

// dateRange的时间
const [expirationTime, setExpirationTime] = useState<dayjs.Dayjs>(dayjs());
const [expirationTime, setExpirationTime] = useState<dayjs.Dayjs>(dayjs().add(1, "day").endOf("day"));

// 对dateRange时间根据options选项进行处理
React.useEffect(() => {
Expand All @@ -72,31 +72,31 @@ const PickExpDate: React.FC<PickExpDateProps> = (props) => {

// 一周
case "oneWeek":
newDate = dayjs().add(1, "week");
newDate = dayjs().add(1, "week").endOf("day");
break;

// 一个礼拜
case "oneMonth":
newDate = dayjs().add(1, "month");
newDate = dayjs().add(1, "month").endOf("day");
break;

// 一年
case "oneYear":
newDate = dayjs().add(1, "year");
newDate = dayjs().add(1, "year").endOf("day");
break;

// 永久生效
case "permanent":
newDate = dayjs("2099-12-31");
newDate = dayjs("2099-12-31").endOf("day");
break;

// 自定义时间
case "custom":
newDate = expirationTime ?? dayjs();
newDate = expirationTime ?? dayjs().add(1, "day").endOf("day");
break;

default:
newDate = dayjs();
newDate = dayjs().add(1, "day").endOf("day");
break;
}
// 传递值
Expand All @@ -116,7 +116,7 @@ const PickExpDate: React.FC<PickExpDateProps> = (props) => {
{/* 根据选项禁用或启用 DatePicker */}
<DatePicker
disabled={selectedOption !== "custom"}
minDate={dayjs(dayjs().format(dateFormat))}
minDate={dayjs(dayjs().add(1, "day").format(dateFormat))}
value={ expirationTime }
style={{ width: "60%" }}
onChange={(date) =>
Expand Down

0 comments on commit f0b3162

Please sign in to comment.