MomentJs spreading of time entries


#1

I have a Mongodb collection of

     Number      Start_date         End_date             UserID 
     CHG123 25-09-2016 12:00:00    28-09-2016 13:00:00   userA   
     CHG456 25-09-2016 12:00:00    28-09-2016 13:00:00   userA
     CHG789 25-09-2016 12:00:00    28-09-2016 13:00:00   userB
     CHGabc 25-09-2016 12:00:00    28-09-2016 13:00:00   userA

What is the best way to spread time attribute if they are less than 3 mins apart, else do nothing. This is whether it is

start_date to start_date,
start_date to end_date,
end_start to end_date,
end_date to start_date

So that

CHG123 25-09-2016 12:00:00     28-09-2016 13:00:00    userA
CHG456 25-09-2016 12:03:00     28-09-2016 13:03:00    userA
CHG789 25-09-2016 12:06:00     28-09-2016 13:06:00    userB
CHGabc 25-09-2016 12:09:00     28-09-2016 13:09:00    userA

#2

I don’t think the question is clear. What do you mean by spread time attribute?


#3

Hi @Elie, based on the first item, if the second time is less than 3 mins, then make them 3 mins apart, and now when looking at the second item, and use it as basis for the third time item, if less than 3 mins make them 3 mins apart and so on…

Just edited the layout so you can better view just the minutes portion of start and end, hope that makes sense…


#4

I think moment has an add function you can use to add three minutes