MCPcopy
hub / github.com/feiyu563/PrometheusAlert / firstWeekOffset

Function firstWeekOffset

static/plugins/chart.js/Chart.bundle.js:15887–15894  ·  view source on GitHub ↗
(year, dow, doy)

Source from the content-addressed store, hash-verified

15885
15886 // start-of-first-week - start-of-year
15887 function firstWeekOffset(year, dow, doy) {
15888 var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
15889 fwd = 7 + dow - doy,
15890 // first-week day local weekday -- which local weekday is fwd
15891 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
15892
15893 return -fwdlw + fwd - 1;
15894 }
15895
15896 // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
15897 function dayOfYearFromWeeks(year, week, weekday, dow, doy) {

Callers 3

dayOfYearFromWeeksFunction · 0.85
weekOfYearFunction · 0.85
weeksInYearFunction · 0.85

Calls 1

createUTCDateFunction · 0.85

Tested by

no test coverage detected