Mercurial > lada > lada-client
annotate resources/lib/Date.prototype.getDOY.js @ 792:d572ee3271ac
some work on a context-sensitive toolbar
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 13 May 2015 13:00:13 +0200 |
parents | a0cfe2395e0a |
children |
rev | line source |
---|---|
782
a0cfe2395e0a
Added Prototype for Date to return DOY
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
1 |
a0cfe2395e0a
Added Prototype for Date to return DOY
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
2 // A new Prototype to return the Day of the Year. |
a0cfe2395e0a
Added Prototype for Date to return DOY
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
3 // Taken from: http://javascript.about.com/library/bldayyear.htm |
a0cfe2395e0a
Added Prototype for Date to return DOY
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
4 Date.prototype.getDOY = function() { |
a0cfe2395e0a
Added Prototype for Date to return DOY
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
5 var onejan = new Date(this.getFullYear(),0,1); |
a0cfe2395e0a
Added Prototype for Date to return DOY
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
6 return Math.ceil((this - onejan) / 86400000); |
a0cfe2395e0a
Added Prototype for Date to return DOY
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
7 } |