Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Tengo una lista en la que múltiples Time-In o Time-Out, Break In o Break out

Tengo una lista en la que hay varios Time-In o Time-Out, Break In o Break out. quiero calcular la duración total desde el tiempo de entrada hasta el tiempo de espera

Aquí hay datos.

 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 : '' } ]

aquí está el formulario de entrada [![puede verificar los campos de entrada para una mejor comprensión] [1]] [1]

Nota: el primer tiempo de entrada fue a las 2:28 o el tiempo de salida a las 3:28 y la hora será 1 . después de entrar o salir de nuevo El tiempo de entrada es a las 6:28 o el Tiempo de salida a las 7:28 y la hora será 1 . ahora las horas son 2. Por favor, alguien sugiera cómo puedo obtener la duración total 2 usando JavaScript, Typescript.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Aquí hay un ejemplo reproducible mínimo para determinar la diferencia entre dos cadenas de tiempo (formateadas como 'hh: mm').

 const tIN = '03:28'.split(`:`).map(Number); const tOUT = '04:28'.split(`:`).map(Number); let [now, then] = [new Date, new Date]; now.setHours(tIN[0]); now.setMinutes(tIN[1]); then.setHours(tOUT[0]); then.setMinutes(tOUT[1]); const diff = dateDiffCalc(then - now); console.log(diff); function dateDiffCalc(milliseconds) { const secs = Math.floor(Math.abs(milliseconds) / 1000); const mins = Math.floor(secs / 60); const hours = Math.floor(mins / 60); return { days: Math.floor(hours / 24), hours: hours % 24, minutes: mins % 60, seconds: secs % 60, }; }

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!