Skip to content

Commit

Permalink
Removed the validation for hh<=23
Browse files Browse the repository at this point in the history
Entered hours could be larger than 23 if exactly or more than 24 hours need to be entered.
  • Loading branch information
maxrugen committed Nov 22, 2023
1 parent f75c4d3 commit cbe82a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function formatToTwoDecimalPlaces(number) {
}
// Function to validate input values
function validateInput(hours, minutes) {
return !isNaN(hours) && !isNaN(minutes) && hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59;
return !isNaN(hours) && !isNaN(minutes) && hours >= 0 && minutes >= 0 && minutes <= 59;
}
// Main conversion function
function convertTime() {
Expand All @@ -41,7 +41,7 @@ function convertTime() {
const decimalHours = calculateIndustrialHours(hours, minutes);
displayResult(`Industrial Hours: ${formatToTwoDecimalPlaces(decimalHours)} hours`, resultElement, errorElement);
} else {
displayError("Invalid entry. Hours must be between 0 and 23, and minutes must be between 0 and 59.", resultElement, errorElement);
displayError("Invalid entry. Minutes must be between 0 and 59.", resultElement, errorElement);
}
} else {
const minutes = parseInt(timeInput);
Expand Down

0 comments on commit cbe82a4

Please sign in to comment.