|
|
|
@ -74,6 +74,19 @@ const ExcelDateToJSDate = (date) => {
|
|
|
|
|
return String(day + '-' + month + '-' + year.slice(2, 4)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const ExcelDateToJSDateEndDay = (date) => { |
|
|
|
|
let converted_date = new Date(Math.round((date - 25569) * 864e5)); |
|
|
|
|
converted_date = String(converted_date).slice(4, 15) |
|
|
|
|
date = converted_date.split(" ") |
|
|
|
|
let day = date[1]; |
|
|
|
|
let month = date[0]; |
|
|
|
|
month = "JanFebMarAprMayJunJulAugSepOctNovDec".indexOf(month) / 3 + 1 |
|
|
|
|
if (month.toString().length <= 1) |
|
|
|
|
month = '0' + month |
|
|
|
|
let year = date[2]; |
|
|
|
|
return String(day + '-' + month + '-' + year.slice(2, 4) + " 23:59:59+07") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const ImportActivity = ({ params }) => { |
|
|
|
|
const pageName = params.name; |
|
|
|
|
|
|
|
|
@ -127,10 +140,14 @@ const ImportActivity = ({ params }) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// convert excel's DATEVALUE
|
|
|
|
|
if(["start_date", "end_date"].includes(prop)){ |
|
|
|
|
if(["start_date"].includes(prop)){ |
|
|
|
|
columnData = ExcelDateToJSDate(columnData) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(["end_date"].includes(prop)){ |
|
|
|
|
columnData = ExcelDateToJSDateEndDay(columnData) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(prop == 'weight'){ |
|
|
|
|
if (columnData == null) { |
|
|
|
|
columnData = 0; |
|
|
|
@ -235,6 +252,9 @@ const ImportActivity = ({ params }) => {
|
|
|
|
|
title: 'Finish Date', |
|
|
|
|
dataIndex: 'end_date', |
|
|
|
|
key: 'end_date', |
|
|
|
|
render: (text, record) => { |
|
|
|
|
return <span>{text.substring(0,8)}</span> |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: 'Duration', |
|
|
|
|