fix:function_calculateAge
This commit is contained in:
parent
8867829211
commit
6f40ee330c
10 changed files with 41 additions and 152 deletions
|
|
@ -5,7 +5,7 @@ import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
|
import { calculateAge } from "@/utils/function";
|
||||||
|
|
||||||
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
|
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
|
||||||
|
|
||||||
|
|
@ -17,8 +17,6 @@ const age = defineModel<string | null>("age", {
|
||||||
});
|
});
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const storeProfile = useProfileDataStore();
|
|
||||||
const { filterSelector, calculateAge } = storeProfile;
|
|
||||||
const { date2Thai, messageError, dialogMessageNotify } = useCounterMixin();
|
const { date2Thai, messageError, dialogMessageNotify } = useCounterMixin();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,11 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useLinkageStore } from "@/stores/linkage";
|
import { useLinkageStore } from "@/stores/linkage";
|
||||||
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
|
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
|
||||||
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
|
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
|
||||||
|
import { calculateAge } from "@/utils/function";
|
||||||
|
|
||||||
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
||||||
import type { RequestregistrationAddressObject } from "@/modules/04_registryPerson/interface/request/Address";
|
import type { RequestregistrationAddressObject } from "@/modules/04_registryPerson/interface/request/Address";
|
||||||
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
|
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
|
||||||
import type {
|
|
||||||
FormPerson,
|
|
||||||
FormChildren,
|
|
||||||
} from "@/modules/04_registryPerson/interface/index/family";
|
|
||||||
|
|
||||||
import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popup
|
import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popup
|
||||||
import InformationPage from "@/modules/04_registryPerson/components/Dialog/01_Information.vue"; //form ข้อมูลส่วนตัว
|
import InformationPage from "@/modules/04_registryPerson/components/Dialog/01_Information.vue"; //form ข้อมูลส่วนตัว
|
||||||
|
|
@ -268,7 +265,7 @@ async function amiRequest() {
|
||||||
formInformations.birthDate = data.value.dateOfBirth
|
formInformations.birthDate = data.value.dateOfBirth
|
||||||
? conventDateOfBirth(`${data.value.dateOfBirth}`)
|
? conventDateOfBirth(`${data.value.dateOfBirth}`)
|
||||||
: null;
|
: null;
|
||||||
age.value = storeLinkCenter.calculateAge(data.value.age);
|
age.value = calculateAge(data.value.dateOfBirth);
|
||||||
formInformations.gender = data.value.genderDesc;
|
formInformations.gender = data.value.genderDesc;
|
||||||
|
|
||||||
let registrationAddress = data.value.houseNo ? data.value.houseNo : "";
|
let registrationAddress = data.value.houseNo ? data.value.houseNo : "";
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { checkPermission } from "@/utils/permissions";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
|
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
|
||||||
|
import { calculateAge } from "@/utils/function";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
|
@ -22,7 +23,7 @@ import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogH
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = useProfileDataStore();
|
const store = useProfileDataStore();
|
||||||
const { calculateAge, fetchPerson, filterSelector } = store;
|
const { fetchPerson, filterSelector } = store;
|
||||||
const {
|
const {
|
||||||
success,
|
success,
|
||||||
showLoader,
|
showLoader,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ const mixin = useCounterMixin();
|
||||||
const { showLoader, hideLoader } = mixin;
|
const { showLoader, hideLoader } = mixin;
|
||||||
|
|
||||||
export const useDataLinkCenter = defineStore("DataLinkCenter", () => {
|
export const useDataLinkCenter = defineStore("DataLinkCenter", () => {
|
||||||
const retireDate = ref<Date>();
|
|
||||||
const optionRelationshipMain = ref<DataOption[]>([]);
|
const optionRelationshipMain = ref<DataOption[]>([]);
|
||||||
const optionRelationship = ref<DataOption[]>([]);
|
const optionRelationship = ref<DataOption[]>([]);
|
||||||
//รายการตัวเลือก
|
//รายการตัวเลือก
|
||||||
|
|
@ -70,32 +69,6 @@ export const useDataLinkCenter = defineStore("DataLinkCenter", () => {
|
||||||
subdistrictCOps: [],
|
subdistrictCOps: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันคำนวนอายุด้วยวันเดิอนปีเกิด
|
|
||||||
* @param birthDate วันเกิด
|
|
||||||
* @returns อายุ
|
|
||||||
*/
|
|
||||||
function calculateAge(birthDate: Date | null) {
|
|
||||||
if (!birthDate) return null;
|
|
||||||
const birthDateTimeStamp = new Date(birthDate).getTime();
|
|
||||||
const now = new Date();
|
|
||||||
const diff = now.getTime() - birthDateTimeStamp;
|
|
||||||
|
|
||||||
const ageDate = new Date(diff);
|
|
||||||
const years = ageDate.getUTCFullYear() - 1970;
|
|
||||||
const months = ageDate.getUTCMonth();
|
|
||||||
const days = ageDate.getUTCDate() - 1;
|
|
||||||
const retire = new Date(birthDate);
|
|
||||||
retire.setFullYear(retire.getFullYear() + 60);
|
|
||||||
retireDate.value = retire;
|
|
||||||
|
|
||||||
if (years > 60) {
|
|
||||||
return "อายุเกิน 60 ปี";
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${years} ปี ${months} เดือน ${days} วัน`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันดึงข้อมูลตัวเลือกข้อมูลหลัก
|
* ฟังก์ชันดึงข้อมูลตัวเลือกข้อมูลหลัก
|
||||||
*/
|
*/
|
||||||
|
|
@ -351,7 +324,7 @@ export const useDataLinkCenter = defineStore("DataLinkCenter", () => {
|
||||||
OpsPerson,
|
OpsPerson,
|
||||||
OpsAddress,
|
OpsAddress,
|
||||||
OpsAddressFilter,
|
OpsAddressFilter,
|
||||||
calculateAge,
|
|
||||||
fetchProvince,
|
fetchProvince,
|
||||||
filterSelector,
|
filterSelector,
|
||||||
fetchDistrict,
|
fetchDistrict,
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ const mixin = useCounterMixin();
|
||||||
const { showLoader, hideLoader } = mixin;
|
const { showLoader, hideLoader } = mixin;
|
||||||
|
|
||||||
export const useProfileDataStore = defineStore("profile", () => {
|
export const useProfileDataStore = defineStore("profile", () => {
|
||||||
const retireDate = ref<Date>();
|
|
||||||
|
|
||||||
//ข้อมูลส่วนตัว
|
//ข้อมูลส่วนตัว
|
||||||
const defaultProfile: RequestObject = {
|
const defaultProfile: RequestObject = {
|
||||||
bloodGroup: null,
|
bloodGroup: null,
|
||||||
|
|
@ -69,32 +67,6 @@ export const useProfileDataStore = defineStore("profile", () => {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันคำนวนอายุด้วยวันเดิอนปีเกิด
|
|
||||||
* @param birthDate วันเกิด
|
|
||||||
* @returns อายุ
|
|
||||||
*/
|
|
||||||
function calculateAge(birthDate: Date | null) {
|
|
||||||
if (!birthDate) return null;
|
|
||||||
const birthDateTimeStamp = new Date(birthDate).getTime();
|
|
||||||
const now = new Date();
|
|
||||||
const diff = now.getTime() - birthDateTimeStamp;
|
|
||||||
|
|
||||||
const ageDate = new Date(diff);
|
|
||||||
const years = ageDate.getUTCFullYear() - 1970;
|
|
||||||
const months = ageDate.getUTCMonth();
|
|
||||||
const days = ageDate.getUTCDate() - 1;
|
|
||||||
const retire = new Date(birthDate);
|
|
||||||
retire.setFullYear(retire.getFullYear() + 60);
|
|
||||||
retireDate.value = retire;
|
|
||||||
|
|
||||||
if (years > 60) {
|
|
||||||
return "อายุเกิน 60 ปี";
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${years} ปี ${months} เดือน ${days} วัน`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันดึงข้อมูลตัวเลือกข้อมูลหลัก
|
* ฟังก์ชันดึงข้อมูลตัวเลือกข้อมูลหลัก
|
||||||
*/
|
*/
|
||||||
|
|
@ -247,11 +219,9 @@ export const useProfileDataStore = defineStore("profile", () => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
defaultProfile,
|
defaultProfile,
|
||||||
retireDate,
|
|
||||||
Ops,
|
Ops,
|
||||||
OpsFilter,
|
OpsFilter,
|
||||||
|
|
||||||
calculateAge,
|
|
||||||
fetchPerson,
|
fetchPerson,
|
||||||
filterSelector,
|
filterSelector,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { calculateAge } from "@/utils/function";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
|
@ -16,7 +17,6 @@ import type {
|
||||||
FormAddPerson,
|
FormAddPerson,
|
||||||
} from "@/modules/05_placement/interface/index/ProfileType";
|
} from "@/modules/05_placement/interface/index/ProfileType";
|
||||||
|
|
||||||
const retireDate = ref<Date>();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
|
|
@ -25,14 +25,12 @@ const {
|
||||||
success,
|
success,
|
||||||
dateToISO,
|
dateToISO,
|
||||||
messageError,
|
messageError,
|
||||||
dialogMessageNotify,
|
|
||||||
showLoader,
|
showLoader,
|
||||||
hideLoader,
|
hideLoader,
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
const age = ref<string | null>("");
|
const age = ref<string | null>("");
|
||||||
const defaultCitizenData = ref<string>("");
|
|
||||||
const informaData = ref<FormAddPerson>({
|
const informaData = ref<FormAddPerson>({
|
||||||
prefix: "",
|
prefix: "",
|
||||||
firstName: "",
|
firstName: "",
|
||||||
|
|
@ -283,32 +281,6 @@ function clickBack() {
|
||||||
router.push("/placement/receive");
|
router.push("/placement/receive");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันคำนวนอายุ
|
|
||||||
* @param birthDate วันเดือยปีเกิด
|
|
||||||
* @returns อายุ แบบ ปี เดือน วัน
|
|
||||||
*/
|
|
||||||
function calculateAge(birthDate: Date | null) {
|
|
||||||
if (!birthDate) return null;
|
|
||||||
const birthDateTimeStamp = new Date(birthDate).getTime();
|
|
||||||
const now = new Date();
|
|
||||||
const diff = now.getTime() - birthDateTimeStamp;
|
|
||||||
|
|
||||||
const ageDate = new Date(diff);
|
|
||||||
const years = ageDate.getUTCFullYear() - 1970;
|
|
||||||
const months = ageDate.getUTCMonth();
|
|
||||||
const days = ageDate.getUTCDate() - 1;
|
|
||||||
const retire = new Date(birthDate);
|
|
||||||
retire.setFullYear(retire.getFullYear() + 60);
|
|
||||||
retireDate.value = retire;
|
|
||||||
|
|
||||||
if (years > 60) {
|
|
||||||
return "อายุเกิน 60 ปี";
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${years} ปี ${months} เดือน ${days} วัน`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันอัปเดทวันเดือนปีเกิด
|
* ฟังก์ชันอัปเดทวันเดือนปีเกิด
|
||||||
* @param v วันเดือยปีเกิด
|
* @param v วันเดือยปีเกิด
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
|
import { calculateAge } from "@/utils/function";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
|
@ -264,8 +265,6 @@ async function getData() {
|
||||||
salary.value = data.amountOld ?? 0;
|
salary.value = data.amountOld ?? 0;
|
||||||
reason.value = data.reason ?? "";
|
reason.value = data.reason ?? "";
|
||||||
status.value = data.status ?? "";
|
status.value = data.status ?? "";
|
||||||
|
|
||||||
calculateAge(data.dateOfBirth);
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -510,31 +509,6 @@ function calculateMaxDate() {
|
||||||
return today;
|
return today;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* ฟังก์ชันคำนวนอายุ
|
|
||||||
* @param birthDate วันเดือยปีเกิด
|
|
||||||
* @returns อายุ แบบ ปี เดือน วัน
|
|
||||||
*/
|
|
||||||
function calculateAge(birthDate: Date | null) {
|
|
||||||
if (!birthDate) return null;
|
|
||||||
const birthDateTimeStamp = new Date(birthDate).getTime();
|
|
||||||
const now = new Date();
|
|
||||||
const diff = now.getTime() - birthDateTimeStamp;
|
|
||||||
|
|
||||||
const ageDate = new Date(diff);
|
|
||||||
const years = ageDate.getUTCFullYear() - 1970;
|
|
||||||
const months = ageDate.getUTCMonth();
|
|
||||||
const days = ageDate.getUTCDate() - 1;
|
|
||||||
const retire = new Date(birthDate);
|
|
||||||
retire.setFullYear(retire.getFullYear() + 60);
|
|
||||||
|
|
||||||
if (years > 60) {
|
|
||||||
return "อายุเกิน 60 ปี";
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${years} ปี ${months} เดือน ${days} วัน`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันอัปเดทวันเดือนปีเกิด
|
* ฟังก์ชันอัปเดทวันเดือนปีเกิด
|
||||||
* @param v วันเดือยปีเกิด
|
* @param v วันเดือยปีเกิด
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ import config from "@/app.config";
|
||||||
import type { DataOption } from "@/modules/08_registryEmployee/interface/index/Main";
|
import type { DataOption } from "@/modules/08_registryEmployee/interface/index/Main";
|
||||||
import type { FormDataEmployee } from "@/modules/08_registryEmployee/interface/request/Employee";
|
import type { FormDataEmployee } from "@/modules/08_registryEmployee/interface/request/Employee";
|
||||||
import type { ResOptionPerson } from "@/modules/08_registryEmployee/interface/response/Employee";
|
import type { ResOptionPerson } from "@/modules/08_registryEmployee/interface/response/Employee";
|
||||||
|
import { calculateAge } from "@/utils/function";
|
||||||
|
|
||||||
/** importComponents*/
|
/** importComponents*/
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
/** importStore*/
|
/** importStore*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useRegistryEmp } from "@/modules/08_registryEmployee/stores/registry-employee";
|
|
||||||
|
|
||||||
/** use*/
|
/** use*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
@ -27,7 +27,6 @@ const {
|
||||||
dialogMessageNotify,
|
dialogMessageNotify,
|
||||||
date2Thai,
|
date2Thai,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
const { calculateAge } = useRegistryEmp();
|
|
||||||
|
|
||||||
/** props*/
|
/** props*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,6 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
export const useRegistryEmp = defineStore("registryEmployeeTemp", () => {
|
export const useRegistryEmp = defineStore("registryEmployeeTemp", () => {
|
||||||
/**
|
|
||||||
* function คำนวณหาอายุ
|
|
||||||
* @param birthDate วันเกิด
|
|
||||||
* @returns อายุ
|
|
||||||
*/
|
|
||||||
function calculateAge(birthDate: Date | null) {
|
|
||||||
if (!birthDate) return null;
|
|
||||||
const birthDateTimeStamp = new Date(birthDate).getTime();
|
|
||||||
const now = new Date();
|
|
||||||
const diff = now.getTime() - birthDateTimeStamp;
|
|
||||||
|
|
||||||
const ageDate = new Date(diff);
|
|
||||||
const years = ageDate.getUTCFullYear() - 1970;
|
|
||||||
const months = ageDate.getUTCMonth();
|
|
||||||
const days = ageDate.getUTCDate() - 1;
|
|
||||||
const retire = new Date(birthDate);
|
|
||||||
retire.setFullYear(retire.getFullYear() + 60);
|
|
||||||
// retireDate.value = retire;
|
|
||||||
|
|
||||||
if (years > 60) {
|
|
||||||
return "อายุเกิน 60 ปี";
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${years} ปี ${months} เดือน ${days} วัน`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function convertstatus
|
* function convertstatus
|
||||||
* @param val ค่าสภานะ
|
* @param val ค่าสภานะ
|
||||||
|
|
@ -53,7 +27,6 @@ export const useRegistryEmp = defineStore("registryEmployeeTemp", () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
calculateAge,
|
|
||||||
statusText,
|
statusText,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* คำนวณหน้าที่จะแสดงหลังจากลบข้อมูล
|
* คำนวณหน้าที่จะแสดงหลังจากลบข้อมูล
|
||||||
*
|
*
|
||||||
|
|
@ -28,3 +30,33 @@ export function calculateFiscalYear(date: Date) {
|
||||||
const month = date.getMonth() + 1;
|
const month = date.getMonth() + 1;
|
||||||
return month >= 10 ? date.getFullYear() + 1 : date.getFullYear();
|
return month >= 10 ? date.getFullYear() + 1 : date.getFullYear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* คำนวณอายุจากวันเกิด
|
||||||
|
* @param birthDate วันเกิด
|
||||||
|
* @returns อายุในรูปแบบ ปี เดือน วัน หรือ ข้อความ "อายุเกิน 60 ปี" หรือ null หากวันเกิดเป็น null
|
||||||
|
*/
|
||||||
|
export function calculateAge(birthDate: Date | null) {
|
||||||
|
if (!birthDate) return null;
|
||||||
|
|
||||||
|
// .startOf('day') จะเซ็ตเวลาเป็น 00:00:00.000 ของวันนั้นๆ
|
||||||
|
const birth = moment(birthDate).startOf("day");
|
||||||
|
const now = moment().startOf("day");
|
||||||
|
|
||||||
|
if (!birth.isValid()) return "Invalid Date";
|
||||||
|
|
||||||
|
// คราวนี้การลบกันจะสนแค่ "วันที่" เท่านั้น
|
||||||
|
const years = now.diff(birth, "years");
|
||||||
|
birth.add(years, "years");
|
||||||
|
|
||||||
|
const months = now.diff(birth, "months");
|
||||||
|
birth.add(months, "months");
|
||||||
|
|
||||||
|
const days = now.diff(birth, "days");
|
||||||
|
|
||||||
|
if (years >= 60) {
|
||||||
|
return "อายุเกิน 60 ปี";
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${years} ปี ${months} เดือน ${days} วัน`;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue