Browse Source

Merge pull request 'staging upload 23-05-16' (#37) from staging into master

Reviewed-on: ordo/adw-frontend#37
pull/2/head
ibnu 2 years ago
parent
commit
4e85988c1b
  1. 22
      src/views/SimproV2/CreatedProyek/ImportActivity/index.js

22
src/views/SimproV2/CreatedProyek/ImportActivity/index.js

@ -74,6 +74,19 @@ const ExcelDateToJSDate = (date) => {
return String(day + '-' + month + '-' + year.slice(2, 4)) 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 ImportActivity = ({ params }) => {
const pageName = params.name; const pageName = params.name;
@ -127,10 +140,14 @@ const ImportActivity = ({ params }) => {
} }
// convert excel's DATEVALUE // convert excel's DATEVALUE
if(["start_date", "end_date"].includes(prop)){ if(["start_date"].includes(prop)){
columnData = ExcelDateToJSDate(columnData) columnData = ExcelDateToJSDate(columnData)
} }
if(["end_date"].includes(prop)){
columnData = ExcelDateToJSDateEndDay(columnData)
}
if(prop == 'weight'){ if(prop == 'weight'){
if (columnData == null) { if (columnData == null) {
columnData = 0; columnData = 0;
@ -235,6 +252,9 @@ const ImportActivity = ({ params }) => {
title: 'Finish Date', title: 'Finish Date',
dataIndex: 'end_date', dataIndex: 'end_date',
key: 'end_date', key: 'end_date',
render: (text, record) => {
return <span>{text.substring(0,8)}</span>
}
}, },
{ {
title: 'Duration', title: 'Duration',

Loading…
Cancel
Save