same-encoder
same-encoder copied to clipboard
Lengths of 15 and 45 Minutes are Not Supported
The code in same-validator.js does not properly check for 15 minute lengths when the hour is less than 1. The current code is:
if (hr <= 1 && (mn % 15 !== 0)) {
return false;
}
If the value of mn is 15 or 45, the test does not return false but it does not return true either. The code then proceeds to the next check and returns false on the following statement:
if (mn % 30 !== 0) {
return false;
}
I changed the 15 minute increment check in my implementation to the following which is working fine in my code:
if (hr < 1) return (mn % 15 === 0);