Skip to content

Instantly share code, notes, and snippets.

View nicholaskajoh's full-sized avatar
👨‍💻
Debugging

Nicholas Kajoh nicholaskajoh

👨‍💻
Debugging
View GitHub Profile
/* calculate the difference in minutes between 2 date times
given that only the minutes within a specified time range
every day should be counted
e.g: say the time range is 6AM to 6PM
if datetime1 = 4AM and datetime2 = 5AM, difference = 0 minutes
this is because 4AM to 5AM doesn't fall within the range of
6AM to 6PM so the 60 minutes isn't counted
e.g 2: say we have same time range and,
datetime1 = 5AM today and datetime2 = 7PM tomorrow,
difference = 1440 minutes