This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formatDurationPolls = ( | |
createdAt: Date, | |
duration: number, | |
timeOfEdit: Date = new Date() | |
) => { | |
const ends = moment(new Date(createdAt).getTime() + duration * 60000); | |
const days = moment(timeOfEdit).diff(ends, 'days') * -1; | |
const hours = moment(timeOfEdit).diff(ends, 'hours') * -1 - days * 24; | |
const minutes = | |
moment(timeOfEdit).diff(ends, 'minutes') * -1 - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colorChecker(red,green,blue){ | |
if (1 - (0.299 * red + 0.587 * green + 0.114 * blue) / 255 < 0.5) { | |
//light | |
} | |
else { | |
// dark | |
} | |
} |