修改日历时间
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
color: theme.$primary-color;
|
color: theme.$primary-color;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
.participant-control-checkbox-wrapper{
|
.participant-control-checkbox-wrapper{
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
getMonth,
|
getMonth,
|
||||||
getWeekend,
|
getWeekend,
|
||||||
getWeekendOfCurrentWeek,
|
getWeekendOfCurrentWeek,
|
||||||
|
getOneMonth
|
||||||
} from "@/utils/timeUtils";
|
} from "@/utils/timeUtils";
|
||||||
import { PopupPicker } from "@/components/Picker/index";
|
import { PopupPicker } from "@/components/Picker/index";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
@@ -165,7 +166,7 @@ const NutUICalendar = React.forwardRef<CalendarUIRef, NutUICalendarProps>(
|
|||||||
onChange?.(dayList);
|
onChange?.(dayList);
|
||||||
};
|
};
|
||||||
const selectMonth = () => {
|
const selectMonth = () => {
|
||||||
const dayList = getWeekendOfCurrentWeek(30);
|
const dayList = getOneMonth();
|
||||||
setSelectedValue(dayList);
|
setSelectedValue(dayList);
|
||||||
syncMonthTo(dayList[0]);
|
syncMonthTo(dayList[0]);
|
||||||
onChange?.(dayList);
|
onChange?.(dayList);
|
||||||
|
|||||||
@@ -293,3 +293,19 @@ export const calculateDuration = (startTime: string, endTime: string): string =>
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getOneMonth = (): Date[] => {
|
||||||
|
const dates: Date[] = [];
|
||||||
|
const currentDate = dayjs();
|
||||||
|
const nextMonth = dayjs().add(1, 'month');
|
||||||
|
|
||||||
|
// 从当前日期开始,遍历到下个月的同一天
|
||||||
|
let date = currentDate;
|
||||||
|
while (date.isBefore(nextMonth) || date.isSame(nextMonth, 'day')) {
|
||||||
|
dates.push(date.toDate());
|
||||||
|
date = date.add(1, 'day');
|
||||||
|
}
|
||||||
|
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user