I have a list in which multiple Time-In or Time-Out , Break In or Break out

Published

I have a list in which multiple Time-In or Time-Out , Break In or Break out.
i want to calculate total duration from Time-In to Time-Out

Here is data.

const data = 
  [ { timeSheetDetailActivityId : 0
    , timeSheetDailyActivityId  : 0
    , entryDateTime             : '02:28'
    , activityTypeId            : 'Time In'
    , comments                  : 'dgdfgdfg'
    , isLeave                   : ''
    } 
  , { timeSheetDetailActivityId : 0
    , timeSheetDailyActivityId  : 0
    , entryDateTime             : '03:28'
    , activityTypeId            : 'Time Out'
    , comments                  : '2323'
    , isLeave                   : ''
    } 
  , { timeSheetDetailActivityId : 0
    , timeSheetDailyActivityId  : 0
    , entryDateTime             : '04:28'
    , activityTypeId            : 'Break In'
    , comments                  : '2323'
    , isLeave                   : ''
    } 
  , { timeSheetDetailActivityId : 0
    , timeSheetDailyActivityId  : 0
    , entryDateTime             : '05:28'
    , activityTypeId            : 'Break Out'
    , comments                  : '2323'
    , isLeave                   : ''
    } 
  , { timeSheetDetailActivityId : 0
    , timeSheetDailyActivityId  : 0
    , entryDateTime             : '06:28'
    , activityTypeId            : 'Time In'
    , comments                  : '2323'
    , isLeave                   : ''
    } 
  , { timeSheetDetailActivityId : 0
    , timeSheetDailyActivityId  : 0
    , entryDateTime             : '07:28'
    , activityTypeId            : 'Time Out'
    , comments                  : '232323'
    , isLeave                   : ''
    } 
  ] 

here is Input form
[![you can check input fields for better understanding][1]][1]

Note :
so first Time-in was 2:28 or Time-out 3:28 and hour will be 1.
after break-in or break out again Time-in is 6:28 or Time-out 7:28 and hour will be 1.
now hours is 2.
Please any body suggest how I can get total duration 2 in using JavaScript , Typescript.

Source: Angular Questions

Published
Categorized as angular, arrays, javascript, jquery Tagged , , ,

Answers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq