1.1.4 • Published 10 years ago
end-of-time v1.1.4
End of time is coming!
Description
Totally useless little module that assumes the world will end when the
JavaScript Date.now() goes above Number.MAX_SAFE_INTEGER
Code
var EndOfTime = function() {
	return {
		millisecondsToYears : function (ms) {
			return Math.floor(ms / (1000 * 60 * 60 * 24 * 356));
		},
		getThisYear : function(){
			return new Date().getFullYear();
		},
		getMaxYear : function(){
			return this.millisecondsToYears(Number.MAX_SAFE_INTEGER);
		},
		getYearsLeft : function(){
			return this.getMaxYear() - this.getThisYear();
		}
	}
}
module.exports = EndOfTime;Test
npm test