Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 55acc64

Browse files
tanxvalentinewallace
authored andcommitted
Change type check
1 parent 10c3732 commit 55acc64

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/helper.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,11 @@ export const generateArc = (x, y, radius, startAngle, endAngle) => {
329329
* @return {string} The amount of time the blocks is equivalent to.
330330
*/
331331
export const getTimeTilAvailable = numBlocks => {
332-
let num = Number(numBlocks);
333-
if (isNaN(num)) {
332+
if (!Number.isInteger(numBlocks)) {
334333
throw new Error('Invalid input!');
335334
}
336-
const days = Math.floor(num / (24 * 6));
337-
const hours = Math.floor((num % (24 * 6)) / 6);
335+
const days = Math.floor(numBlocks / (24 * 6));
336+
const hours = Math.floor((numBlocks % (24 * 6)) / 6);
338337
const daysString = days === 1 ? 'day' : 'days';
339338
const hoursString = hours === 1 ? 'hour' : 'hours';
340339
return `${days} ${daysString} and ${hours} ${hoursString}`;

0 commit comments

Comments
 (0)