changeset 782:a0cfe2395e0a

Added Prototype for Date to return DOY
author Dustin Demuth <dustin@intevation.de>
date Tue, 12 May 2015 17:49:09 +0200
parents 4c1101f0ba99
children afdbe3770b99 d2ee6858f452
files resources/lib/Date.prototype.getDOY.js
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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);
+}

http://lada.wald.intevation.org