Skip to content

Commit

Permalink
Create time.js
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKitoInc committed Jul 6, 2024
1 parent 25bc04e commit 027be79
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/checks/time.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { tryInteger } = require("./types");

module.exports.tryHour = function (value) {
tryInteger(value);
if (value < 0 || value > 23) {
throw new Error("Hour out of range: " + value);
}
};
module.exports.tryMinute = function (value) {
tryInteger(value);
if (value < 0 || value > 59) {
throw new Error("Minute out of range: " + value);
}
};
module.exports.trySecond = function (value) {
tryInteger(value);
if (value < 0 || value > 59) {
throw new Error("Second out of range: " + value);
}
};

0 comments on commit 027be79

Please sign in to comment.