Created
September 26, 2023 05:17
-
-
Save jagdishlove/e54c0f3d50260238a7693a4d7c888c96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## adding multiple hours timedifference in javascript | |
function minutesToHours(minutes) { | |
const h = Math.floor(minutes / 60); | |
const m = minutes % 60; | |
return `${h}.${m < 10 ? "0" : ""}${m}`; | |
} | |
const totalMinutes = getTimesheetData?.reduce((sum, entry) => { | |
return sum + hoursToMinutes(entry.noOfHours); | |
}, 0); | |
const totalHours = minutesToHours(totalMinutes); | |
console.log("totalHours", totalHours); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment