Adjustment made to web timer
I went to the web timer page today (or, looked at it, I keep it open on one of my screens) to fill in the day of year and realized that I had used the wrong method. I admit, I read the documentation wrong. I verified the android app at this point and confirmed that it’s showing the correct date. The web page was a simple fix, but since I didn’t want to do the math (I have other things to do to, ya know), I looked up what existing solutions were already out there.
The cleanest and most elegant one I found was at http://javascript.about.com/library/bldayyear.htm. They basically wrote an extension to the javascript date library, included here:
Date.prototype.getDOY = function() {
var onejan = new Date(this.getFullYear(),0,1);
return Math.ceil((this – onejan) / 86400000);
}
So, while dates were off by about 30 for one day, all things are well again in the world!
![Share on Facebook Facebook](https://i0.wp.com/johnnyrenaissance.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&ssl=1)
![Share on Twitter twitter](https://i0.wp.com/johnnyrenaissance.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&ssl=1)
![Share on Reddit reddit](https://i0.wp.com/johnnyrenaissance.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/reddit.png?resize=48%2C48&ssl=1)
![Pin it with Pinterest pinterest](https://i0.wp.com/johnnyrenaissance.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/pinterest.png?resize=48%2C48&ssl=1)
![Share on Linkedin linkedin](https://i0.wp.com/johnnyrenaissance.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&ssl=1)
![Share by email mail](https://i0.wp.com/johnnyrenaissance.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/mail.png?resize=48%2C48&ssl=1)