no message
This commit is contained in:
parent
6207ba1a91
commit
fc14f80dc9
5 changed files with 725 additions and 575 deletions
9
package-lock.json
generated
9
package-lock.json
generated
|
|
@ -16,6 +16,7 @@
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"fast-jwt": "^3.3.2",
|
"fast-jwt": "^3.3.2",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"mysql2": "^3.9.1",
|
"mysql2": "^3.9.1",
|
||||||
"node-cron": "^3.0.3",
|
"node-cron": "^3.0.3",
|
||||||
"node-xlsx": "^0.24.0",
|
"node-xlsx": "^0.24.0",
|
||||||
|
|
@ -2877,6 +2878,14 @@
|
||||||
"obliterator": "^2.0.1"
|
"obliterator": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/moment": {
|
||||||
|
"version": "2.30.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
||||||
|
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"fast-jwt": "^3.3.2",
|
"fast-jwt": "^3.3.2",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"mysql2": "^3.9.1",
|
"mysql2": "^3.9.1",
|
||||||
"node-cron": "^3.0.3",
|
"node-cron": "^3.0.3",
|
||||||
"node-xlsx": "^0.24.0",
|
"node-xlsx": "^0.24.0",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,46 @@
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
class Extension {
|
class Extension {
|
||||||
|
public static ConvertToDateTime(value: any) {
|
||||||
|
|
||||||
|
if (value != "" && value != null ) {
|
||||||
|
if(isNaN(value)){
|
||||||
|
let date = moment(value, 'DD/MM/YYYY').toDate();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
if (year < 1800) {
|
||||||
|
return null;
|
||||||
|
} else if (year > 2500) {
|
||||||
|
date.setFullYear(year - 543);
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// return moment.unix(value).format('DD/MM/YYYY');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckRelationship(value: any) {
|
||||||
|
if(value!= "" && value != null) {
|
||||||
|
switch(value) {
|
||||||
|
case 1:
|
||||||
|
return "โสด";
|
||||||
|
case 2:
|
||||||
|
return "สมรส";
|
||||||
|
case 3:
|
||||||
|
return "หย่า";
|
||||||
|
case 4:
|
||||||
|
return "หม้าย";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public static ToThaiMonth(value: number) {
|
public static ToThaiMonth(value: number) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export function calculateRetireDate(birthDate: Date) {
|
||||||
var year = d.getFullYear();
|
var year = d.getFullYear();
|
||||||
var month = d.getMonth();
|
var month = d.getMonth();
|
||||||
var day = d.getDate();
|
var day = d.getDate();
|
||||||
var c = new Date(year + 60, month, day);
|
var c = new Date(year + 60, month, day-1);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
export function calculateRetireLaw(birthDate: Date) {
|
export function calculateRetireLaw(birthDate: Date) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue