Created
March 12, 2012 10:56
-
-
Save Skoog/2021154 to your computer and use it in GitHub Desktop.
ISO 8601 Week Date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gets the real date for an ISO-8601 week-date | |
* | |
* @param year | |
* @param week | |
* @param day | |
*/ | |
function getWeekDate(year, week, day) { | |
var date = new Date(+year, 0, 3); // Jan 3 | |
date.setDate( 3 - date.getDay() + (week -1) * 7 + +day); | |
return date; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment