Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

228
Visualizações
i want convert rows to Colums with specific data in JavaScript array

I have a Array in 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

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.

my suggestion is if i convert above data to get row to Colum with Time-In or Timeout data or calculate duration in next Colum e.g

[ { timeSheetDailyActivityId : 1
  , Time In                  : '02:28'
  , Time Out                 : '03:28'
  , Duraion                  : 1
  , Break In                 : '02:28'
  , Break Out                : '03:28'
  } 
, { timeSheetDailyActivityId : 2
  , Time In                  : '06:28'
  , Time Out                 : '08:28'
  , Duraion                  : 1
  , Break In                 : '02:28'
  , Break Out                : '03:28'
  } 
]

to like this

then i can achieve my goal.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda