update
This commit is contained in:
parent
6e374d7992
commit
a455c14ce6
3 changed files with 182 additions and 3 deletions
|
|
@ -30,6 +30,37 @@ class Extension {
|
|||
}
|
||||
}
|
||||
|
||||
public static ToThaiShortMonth(value: number) {
|
||||
switch (value) {
|
||||
case 1:
|
||||
return "ม.ค.";
|
||||
case 2:
|
||||
return "ก.พ.";
|
||||
case 3:
|
||||
return "มี.ค.";
|
||||
case 4:
|
||||
return "เม.ย.";
|
||||
case 5:
|
||||
return "พ.ค.";
|
||||
case 6:
|
||||
return "มิ.ย.";
|
||||
case 7:
|
||||
return "ก.ค.";
|
||||
case 8:
|
||||
return "ส.ค.";
|
||||
case 9:
|
||||
return "ก.ย.";
|
||||
case 10:
|
||||
return "ต.ค.";
|
||||
case 11:
|
||||
return "พ.ย.";
|
||||
case 12:
|
||||
return "ธ.ค.";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static ToThaiYear(value: number) {
|
||||
if (value < 2400) return value + 543;
|
||||
else return value;
|
||||
|
|
@ -86,6 +117,18 @@ class Extension {
|
|||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
public static ToThaiShortDate(value: Date) {
|
||||
let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear();
|
||||
return (
|
||||
value.getDate() +
|
||||
" " +
|
||||
Extension.ToThaiShortMonth(value.getMonth() + 1) +
|
||||
" " +
|
||||
yy.toString().slice(-2)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Extension;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue