chore: improve calendar utils (#8521)

This commit is contained in:
neverland
2021-04-14 10:16:02 +08:00
committed by GitHub
parent 35edb72b5c
commit 9381640d2e
2 changed files with 17 additions and 37 deletions
+5 -5
View File
@@ -14,8 +14,8 @@ import {
t,
bem,
name,
copyDate,
copyDates,
cloneDate,
cloneDates,
getPrevDay,
getNextDay,
compareDay,
@@ -341,12 +341,12 @@ export default defineComponent({
return true;
};
const onConfirm = () => emit('confirm', copyDates(state.currentDate));
const onConfirm = () => emit('confirm', cloneDates(state.currentDate));
const select = (date: Date | Date[], complete?: boolean) => {
const setCurrentDate = (date: Date | Date[]) => {
state.currentDate = date;
emit('select', copyDates(state.currentDate));
emit('select', cloneDates(state.currentDate));
};
if (complete && props.type === 'range') {
@@ -422,7 +422,7 @@ export default defineComponent({
if (selected) {
const [unselectedDate] = currentDate.splice(selectedIndex, 1);
emit('unselect', copyDate(unselectedDate));
emit('unselect', cloneDate(unselectedDate));
} else if (props.maxRange && currentDate.length >= props.maxRange) {
Toast(props.rangePrompt || t('rangePrompt', props.maxRange));
} else {