feat: 03 => update expiration date handling to accept string format and improve validation
This commit is contained in:
parent
199a008095
commit
095f190f99
3 changed files with 9 additions and 9 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
import { calculateDaysUntilExpire } from 'stores/utils';
|
import { calculateDaysUntilExpire } from 'stores/utils';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
expirationDate: Date;
|
expirationDate?: Date | string;
|
||||||
showAllDay?: boolean;
|
showAllDay?: boolean;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -10,7 +10,7 @@ defineProps<{
|
||||||
<template>
|
<template>
|
||||||
<template
|
<template
|
||||||
v-if="
|
v-if="
|
||||||
calculateDaysUntilExpire(expirationDate) <= 90 ||
|
(expirationDate && calculateDaysUntilExpire(expirationDate) <= 90) ||
|
||||||
(expirationDate !== undefined && !!showAllDay)
|
(expirationDate !== undefined && !!showAllDay)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -2419,26 +2419,26 @@ const emptyCreateDialog = ref(false);
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'personalInfo',
|
name: 'personalInfo',
|
||||||
label: 'customerEmployee.form.group.personalInfo',
|
label: $t('customerEmployee.form.group.personalInfo'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'passport',
|
name: 'passport',
|
||||||
label: 'customerEmployee.fileType.passport',
|
label: $t('customerEmployee.fileType.passport'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'visa',
|
name: 'visa',
|
||||||
label: 'customerEmployee.form.group.visa',
|
label: $t('customerEmployee.form.group.visa'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'healthCheck',
|
name: 'healthCheck',
|
||||||
label: 'customerEmployee.form.group.healthCheck',
|
label: $t('customerEmployee.form.group.healthCheck'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'workHistory',
|
name: 'workHistory',
|
||||||
label: 'customerEmployee.form.group.workHistory',
|
label: $t('customerEmployee.form.group.workHistory'),
|
||||||
},
|
},
|
||||||
{ name: 'other', label: 'customerEmployee.form.group.other' },
|
{ name: 'other', label: $t('customerEmployee.form.group.other') },
|
||||||
].filter((v) => {
|
].filter((v) => {
|
||||||
if (!employeeFormState.statusSavePersonal) {
|
if (!employeeFormState.statusSavePersonal) {
|
||||||
return v.name === 'personalInfo';
|
return v.name === 'personalInfo';
|
||||||
|
|
|
||||||
|
|
@ -511,7 +511,7 @@ export async function getAttachmentHead(api: AxiosInstance, url: string) {
|
||||||
if (res) return res.headers;
|
if (res) return res.headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateDaysUntilExpire(expireDate: Date): number {
|
export function calculateDaysUntilExpire(expireDate: Date | string): number {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const expire = new Date(expireDate);
|
const expire = new Date(expireDate);
|
||||||
const diffInTime = expire.getTime() - today.getTime();
|
const diffInTime = expire.getTime() - today.getTime();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue