MCPcopy Create free account
hub / github.com/angular-ui/ui-router / getFirstThursdayOfYear

Function getFirstThursdayOfYear

test/angular/1.5/angular.js:21024–21030  ·  view source on GitHub ↗
(year)

Source from the content-addressed store, hash-verified

21022}
21023
21024function getFirstThursdayOfYear(year) {
21025 // 0 = index of January
21026 var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();
21027 // 4 = index of Thursday (+1 to account for 1st = 5)
21028 // 11 = index of *next* Thursday (+1 account for 1st = 12)
21029 return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);
21030}
21031
21032function getThursdayThisWeek(datetime) {
21033 return new Date(datetime.getFullYear(), datetime.getMonth(),

Callers 2

weekGetterFunction · 0.70
weekParserFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected