#170 and calAge
This commit is contained in:
parent
a45d3744e5
commit
4be0b068bc
5 changed files with 12 additions and 10 deletions
|
|
@ -309,11 +309,13 @@ class Extension {
|
|||
return years;
|
||||
}
|
||||
|
||||
public static CalculateAgeStrV2(date: Date, plusYear: number = 0, subtractYear: number = 0) {
|
||||
public static CalculateAgeStrV2(date: Date, plusYear: number = 0, subtractYear: number = 0, method?:string) {
|
||||
if (date == null || date == undefined) return "";
|
||||
const currentDate = new Date();
|
||||
if (date > currentDate) {
|
||||
if (date > currentDate && method !== "GET") {
|
||||
throw new Error("วันเกิดต้องไม่มากกว่าวันที่ปัจจุบัน");
|
||||
}else if(date > currentDate && method === "GET"){
|
||||
return ""
|
||||
}
|
||||
|
||||
let years = currentDate.getFullYear() - date.getFullYear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue