# HG changeset patch # User Dustin Demuth # Date 1431445749 -7200 # Node ID a0cfe2395e0aa14ef922919980ba5f39441a63d1 # Parent 4c1101f0ba99ea393412087f2c69be1c1b15e08a Added Prototype for Date to return DOY diff -r 4c1101f0ba99 -r a0cfe2395e0a resources/lib/Date.prototype.getDOY.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resources/lib/Date.prototype.getDOY.js Tue May 12 17:49:09 2015 +0200 @@ -0,0 +1,7 @@ + +// A new Prototype to return the Day of the Year. +// Taken from: http://javascript.about.com/library/bldayyear.htm +Date.prototype.getDOY = function() { + var onejan = new Date(this.getFullYear(),0,1); + return Math.ceil((this - onejan) / 86400000); +}