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';
|
||||
|
||||
defineProps<{
|
||||
expirationDate: Date;
|
||||
expirationDate?: Date | string;
|
||||
showAllDay?: boolean;
|
||||
}>();
|
||||
</script>
|
||||
|
|
@ -10,7 +10,7 @@ defineProps<{
|
|||
<template>
|
||||
<template
|
||||
v-if="
|
||||
calculateDaysUntilExpire(expirationDate) <= 90 ||
|
||||
(expirationDate && calculateDaysUntilExpire(expirationDate) <= 90) ||
|
||||
(expirationDate !== undefined && !!showAllDay)
|
||||
"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -2419,26 +2419,26 @@ const emptyCreateDialog = ref(false);
|
|||
[
|
||||
{
|
||||
name: 'personalInfo',
|
||||
label: 'customerEmployee.form.group.personalInfo',
|
||||
label: $t('customerEmployee.form.group.personalInfo'),
|
||||
},
|
||||
{
|
||||
name: 'passport',
|
||||
label: 'customerEmployee.fileType.passport',
|
||||
label: $t('customerEmployee.fileType.passport'),
|
||||
},
|
||||
{
|
||||
name: 'visa',
|
||||
label: 'customerEmployee.form.group.visa',
|
||||
label: $t('customerEmployee.form.group.visa'),
|
||||
},
|
||||
|
||||
{
|
||||
name: 'healthCheck',
|
||||
label: 'customerEmployee.form.group.healthCheck',
|
||||
label: $t('customerEmployee.form.group.healthCheck'),
|
||||
},
|
||||
{
|
||||
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) => {
|
||||
if (!employeeFormState.statusSavePersonal) {
|
||||
return v.name === 'personalInfo';
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ export async function getAttachmentHead(api: AxiosInstance, url: string) {
|
|||
if (res) return res.headers;
|
||||
}
|
||||
|
||||
export function calculateDaysUntilExpire(expireDate: Date): number {
|
||||
export function calculateDaysUntilExpire(expireDate: Date | string): number {
|
||||
const today = new Date();
|
||||
const expire = new Date(expireDate);
|
||||
const diffInTime = expire.getTime() - today.getTime();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue