Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
# Conflicts: # src/controllers/ImportDataController.ts
This commit is contained in:
commit
7c7ae7db41
8 changed files with 669 additions and 320 deletions
|
|
@ -1,37 +1,41 @@
|
|||
import HttpStatus from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import moment from 'moment';
|
||||
import moment from "moment";
|
||||
|
||||
class Extension {
|
||||
public static ConvertToDateTime(value: any) {
|
||||
|
||||
if (value != "" && value != null ) {
|
||||
if(isNaN(value)){
|
||||
let date = moment(value, 'DD/MM/YYYY').toDate();
|
||||
if (value != "" && value != null) {
|
||||
if (isNaN(value)) {
|
||||
let date = moment(value, "DD/MM/YYYY").toDate();
|
||||
let year = date.getFullYear();
|
||||
if (year < 1800) {
|
||||
return null;
|
||||
return null;
|
||||
} else if (year > 2500) {
|
||||
date.setFullYear(year - 543);
|
||||
date.setFullYear(year - 543);
|
||||
}
|
||||
return date;
|
||||
} else {
|
||||
if (value.toString().length == 4) {
|
||||
if (value < 1800) {
|
||||
return null;
|
||||
} else if (value > 2500) {
|
||||
return new Date(value - 543, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// return moment.unix(value).format('DD/MM/YYYY');
|
||||
// }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CheckRelationship(value: any) {
|
||||
if(value!= "" && value != null) {
|
||||
switch(value) {
|
||||
if (value != "" && value != null) {
|
||||
switch (value) {
|
||||
case 1:
|
||||
return "โสด";
|
||||
return "โสด";
|
||||
case 2:
|
||||
return "สมรส";
|
||||
return "สมรส";
|
||||
case 3:
|
||||
return "หย่า";
|
||||
return "หย่า";
|
||||
case 4:
|
||||
return "หม้าย";
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue