Commit a60969e0 authored by Ahmad Nemati's avatar Ahmad Nemati

git pu

parent b4e7283c
...@@ -56,6 +56,24 @@ async function run() { ...@@ -56,6 +56,24 @@ async function run() {
{ {
adder[i].dates=_.orderBy(adder[i].dates) adder[i].dates=_.orderBy(adder[i].dates)
} }
for (let i=0;i<adder.length;i++)
{
let dates=adder[i].dates
let maxDiff=0
for (let z = 0; z < dates.length - 1; z++) {
let diff = getDaysDiff(dates[z], dates[z + 1])
if (diff > maxDiff)
maxDiff = diff
}
adder[i].diffDay=maxDiff
}
console.log(adder) console.log(adder)
// createConfileADV(JSON.stringify(adder, null, 2)) // createConfileADV(JSON.stringify(adder, null, 2))
...@@ -108,6 +126,16 @@ function createfileADV(data) { ...@@ -108,6 +126,16 @@ function createfileADV(data) {
}); });
} }
function getDaysDiff(start, closed) {
//2019-05-25T05:34:27+04:30
var now = moment(moment(closed, 'YYYY-MM-DD').format());
var end = moment.duration(now.diff(moment(start, 'YYYY-MM-DD')));
// console.log(parseInt(end.asDays()))
return parseInt(end.asDays())
}
function createConfileADV(data) { function createConfileADV(data) {
// console.log(data) // console.log(data)
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment