ublo-lib 1.42.16 → 1.42.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weeks.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/week-selector/services/weeks.ts"],"names":[],"mappings":"AAYA,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,QAO3C;AAoBD,wBAAgB,gBAAgB,CAAC,OAAO,KAAA,EAAE,UAAU,SAAI,QAWvD;AAED,wBAAgB,UAAU,CAAC,IAAI,KAAA,EAAE,aAAa,KAAA,
|
|
1
|
+
{"version":3,"file":"weeks.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/week-selector/services/weeks.ts"],"names":[],"mappings":"AAYA,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,QAO3C;AAoBD,wBAAgB,gBAAgB,CAAC,OAAO,KAAA,EAAE,UAAU,SAAI,QAWvD;AAED,wBAAgB,UAAU,CAAC,IAAI,KAAA,EAAE,aAAa,KAAA,UAiB7C;AAMD,wBAAgB,YAAY,SAY3B;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,QAwBlC;AAED,wBAAgB,UAAU,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA,EAAE,UAAU,SAAI,QAEvD;AAED,wBAAgB,WAAW,CAAC,IAAI,KAAA,UAG/B"}
|
|
@@ -30,7 +30,7 @@ export function getChristmasWeek(endWeek, yearOffset = 0) {
|
|
|
30
30
|
const year = now.getFullYear();
|
|
31
31
|
const month = now.getMonth();
|
|
32
32
|
const date = now.getDate();
|
|
33
|
-
const isAfterChristmas = (month === 11 && date >= 25) || month <
|
|
33
|
+
const isAfterChristmas = (month === 11 && date >= 25) || month < 5;
|
|
34
34
|
const lastChristmasYear = (isAfterChristmas ? year - 1 : year) + yearOffset;
|
|
35
35
|
const lastChristmas = createDate(lastChristmasYear, 11, 25);
|
|
36
36
|
const nextChristmas = createDate(lastChristmasYear + 1, 11, 25);
|
|
@@ -38,11 +38,18 @@ export function getChristmasWeek(endWeek, yearOffset = 0) {
|
|
|
38
38
|
return getPrevSaturday(now <= dateSeasonEnd ? lastChristmas : nextChristmas);
|
|
39
39
|
}
|
|
40
40
|
export function dateToWeek(date, christmasWeek) {
|
|
41
|
-
const
|
|
42
|
-
const diff = date - christmasWeek;
|
|
41
|
+
const diff = date.getTime() - christmasWeek.getTime();
|
|
43
42
|
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
const startYear = christmasWeek.getFullYear();
|
|
44
|
+
const endYear = date.getFullYear();
|
|
45
|
+
let leapDays = 0;
|
|
46
|
+
for (let year = startYear; year <= endYear; year++) {
|
|
47
|
+
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
|
|
48
|
+
leapDays++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const adjustedWeekNumber = Math.round((days - leapDays) / 7);
|
|
52
|
+
return adjustedWeekNumber;
|
|
46
53
|
}
|
|
47
54
|
function getFiltrableSections() {
|
|
48
55
|
return Array.from(document.querySelectorAll("section[data-weeks]"));
|