const validTime = str => parseInt(str.split(":")[0], 10) >= 0 && parseInt(str.split(":")[0], 10) <=
24 && parseInt(str.split(":")[1], 10) >= 0 && parseInt(str.split(":")[1], 10) < 60
// const validTime = str => ~~str.split(":")[0] >= 0 && ~~str.split(":")[0] <= 24 && ~~str.split
(":")[1] >= 0 && ~~str.split(":")[1] < 60
// In the 24-hour time notation, the day begins at midnight, 00:00, and the last minute of the day
begins at 23:59. Where convenient, the notation 24:00 may also be used to refer to midnight at the
end of a given date[5] — that is, 24:00 of one day is the same time as 00:00 of the following day.
/**
* Test Suite
*/
describe('validTime()', () => {
it('returns true for valid time', () => {
// arrange
const str = '13:58';
// act
const result = validTime(str);
// log
console.log("result 1: ", result);
// assert
expect(result).toBe(true);
});
it('returns false when invalid hours', () => {
// arrange
const str = '25:51';
// act
const result = validTime(str);
// log
console.log("result 1: ", result);
// assert
expect(result).toBe(false);
});
it('returns false when invalid minutes', () => {
// arrange
const str = '02:76';
// act
const result = validTime(str);
// log
console.log("result 1: ", result);
// assert