Hello everyone, tell me, please, where is the error nothing works for me
Programming Task: Adding an Interval to a Time
Conditions:
- At the input, the function takes
3parameters: hours, minutes, the interval in minutes, for which you need to change the time. - It is guaranteed that any of the
3parameters is a positive integer. - The clock parameter takes a value in the range
[0, 23]. - The minute parameter takes a value in the range
[0, 59]. - The added interval may be more than
60minutes. - The transition to the next day should be processed correctly.
- The function should return correctly formatted time: 1: 2 -> 01:02
module.exports = function (hours, minutes, interval) { if ((hours >= 0 && hours <=23) && (minutes >= 0 && minutes <=59)) { var newMinutes = (minutes+interval) % 60 ; var newHours = (hours + math.floor((minutes+interval) / 60)) % 24 ; if ((newHours / 10) < 1 ) { newHours = '0' + newHours; } if ((newMinutes / 10) < 1 ) { newMinutes = '0' + newMinutes; } return `${newHours}:${newMinutes}`; } }