🐛(component): datePicker dayJS解析时间错误
This commit is contained in:
parent
2a4dc6532d
commit
d697f0b100
@ -330,8 +330,7 @@ const els = [
|
|||||||
|
|
||||||
const currentYear = ref(getYear());
|
const currentYear = ref(getYear());
|
||||||
const currentMonth = ref(getMonth());
|
const currentMonth = ref(getMonth());
|
||||||
const currentDay = ref<number>();
|
const currentDay = ref<number>(props.modelValue? new Date(props.modelValue).getTime(): -1);
|
||||||
|
|
||||||
const yearList = ref<number[]>(getYears());
|
const yearList = ref<number[]>(getYears());
|
||||||
const dateList = ref<any[]>([]);
|
const dateList = ref<any[]>([]);
|
||||||
const showPane = ref("date");
|
const showPane = ref("date");
|
||||||
@ -345,18 +344,19 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
currentDay.value = props.modelValue
|
|
||||||
? new Date(props.modelValue).getTime()
|
|
||||||
: -1;
|
|
||||||
if (currentDay.value == -1) {
|
if (currentDay.value == -1) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
now();
|
now();
|
||||||
clear();
|
clear();
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
hms.value.hh = dayjs(props.modelValue).hour();
|
let modelValue=props.modelValue;
|
||||||
hms.value.mm = dayjs(props.modelValue).minute();
|
if(modelValue.length===8){ //dayjs 解析时间容错
|
||||||
hms.value.ss = dayjs(props.modelValue).second();
|
modelValue='1970-01-01 '+modelValue;
|
||||||
|
}
|
||||||
|
hms.value.hh = dayjs(modelValue).hour();
|
||||||
|
hms.value.mm = dayjs(modelValue).minute();
|
||||||
|
hms.value.ss = dayjs(modelValue).second();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 计算结果日期
|
// 计算结果日期
|
||||||
|
Loading…
Reference in New Issue
Block a user