I've been writing a lot of time related code recently, and in various files, I always end up re-defining things likevar SECOND = 1000; var MINUTE = 60 * SECOND;This gets frustrating quickly. So I'm considering two possibilities:Getting rid of the constants and instead letting things be inferred from code like 60 * 1000I dislike this option because it's not as human readableAttaching the constants to a global so they only have to be written in one placeI think this is the best way to go, but I'm unsure about the potential consequences of thisI could use a package and import from itThis has the same problem that I'm already doing, which would be defining it everywhere over and overHow do you handle this issue or is it something we have to live with?Side note 1: I am writing this in JavaScript, which is why globals are an option, but I feel like this might still be applicable to other languagesSide note 2: Specifically for JavaScript, why are these constants not already attached to the global objects browser/globals?
How do you handle time unit constants (second, minute, etc)?
javascript;time;globals