MCPcopy Create free account
hub / github.com/diffusionstudio/vits-web / getWeekBasedYear

Function getWeekBasedYear

src/piper.js:3992–4005  ·  view source on GitHub ↗
(date)

Source from the content-addressed store, hash-verified

3990 }
3991 }
3992 function getWeekBasedYear(date) {
3993 var thisDate = addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday);
3994 var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4);
3995 var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4);
3996 var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear);
3997 var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear);
3998 if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) {
3999 if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) {
4000 return thisDate.getFullYear() + 1;
4001 }
4002 return thisDate.getFullYear();
4003 }
4004 return thisDate.getFullYear() - 1;
4005 }
4006 var EXPANSION_RULES_2 = {
4007 '%a': (date) => WEEKDAYS[date.tm_wday].substring(0, 3),
4008 '%A': (date) => WEEKDAYS[date.tm_wday],

Callers 1

_strftimeFunction · 0.85

Calls 3

addDaysFunction · 0.85
getFirstWeekStartDateFunction · 0.85
compareByDayFunction · 0.85

Tested by

no test coverage detected