แก้ import data
This commit is contained in:
parent
13a91fcb90
commit
813fc68221
2 changed files with 79 additions and 12 deletions
|
|
@ -27,6 +27,25 @@ class Extension {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
public static ConvertToDateTimeV2(value: any) {
|
||||
if (value != "" && value != null) {
|
||||
if (value.toString().length > 4) {
|
||||
const chars = value.split("/");
|
||||
let year = Number(chars[2]) + 1900;
|
||||
let month = Extension.MonthToNumber(chars[1]);
|
||||
return new Date(year, month, chars[0]);
|
||||
} else {
|
||||
if (value.toString().length == 4) {
|
||||
if (value < 1800) {
|
||||
return null;
|
||||
} else if (value > 2500) {
|
||||
return new Date(value - 543, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CheckRelationship(value: any) {
|
||||
if (value != "" && value != null) {
|
||||
|
|
@ -76,6 +95,36 @@ class Extension {
|
|||
return "";
|
||||
}
|
||||
}
|
||||
public static MonthToNumber(value: string) {
|
||||
switch (value.trim().toUpperCase()) {
|
||||
case "JAN":
|
||||
return 0;
|
||||
case "FEB":
|
||||
return 1;
|
||||
case "MAR":
|
||||
return 2;
|
||||
case "APR":
|
||||
return 3;
|
||||
case "MAY":
|
||||
return 4;
|
||||
case "JUN":
|
||||
return 5;
|
||||
case "JUL":
|
||||
return 6;
|
||||
case "AUG":
|
||||
return 7;
|
||||
case "SEP":
|
||||
return 8;
|
||||
case "OCT":
|
||||
return 9;
|
||||
case "NOV":
|
||||
return 10;
|
||||
case "DEC":
|
||||
return 11;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static ToThaiShortMonth(value: number) {
|
||||
switch (value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue