From 8e0ca5c2edc9abf8a500d487e4e877681a55001b Mon Sep 17 00:00:00 2001 From: Mohammad Taha Date: Fri, 15 Mar 2024 15:00:01 +0500 Subject: [PATCH] fix(week-number-calculation): if year start day same as selected start day --- package-lock.json | 42 +++++++++++++++---- .../lib/pipes/week-number/week-number.pipe.ts | 2 +- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4a14d12..b57dd00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13746,6 +13746,22 @@ "node": ">=10" } }, + "node_modules/ng-packagr/node_modules/rollup": { + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/ng-packagr/node_modules/rxjs": { "version": "7.6.0", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.6.0.tgz", @@ -16426,16 +16442,16 @@ } }, "node_modules/rollup": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.6.0.tgz", - "integrity": "sha512-qCgiBeSu2/AIOKWGFMiRkjPlGlcVwxAjwpGKQZOQYng+83Hip4PjrWHm7EQX1wnrvRqfTytEihRRfLHdX+hR4g==", + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", "dev": true, + "peer": true, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=14.18.0", - "npm": ">=8.0.0" + "node": ">=10.0.0" }, "optionalDependencies": { "fsevents": "~2.3.2" @@ -29291,6 +29307,15 @@ "brace-expansion": "^2.0.1" } }, + "rollup": { + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, "rxjs": { "version": "7.6.0", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.6.0.tgz", @@ -31314,10 +31339,11 @@ } }, "rollup": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.6.0.tgz", - "integrity": "sha512-qCgiBeSu2/AIOKWGFMiRkjPlGlcVwxAjwpGKQZOQYng+83Hip4PjrWHm7EQX1wnrvRqfTytEihRRfLHdX+hR4g==", + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", "dev": true, + "peer": true, "requires": { "fsevents": "~2.3.2" } diff --git a/projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts b/projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts index 683c348..97c844d 100644 --- a/projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts +++ b/projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts @@ -58,7 +58,7 @@ export class WeekNumberPipe implements PipeTransform { // find out the distance from the first week's first day const roundFigure = ((currentWeekStartDate.getTime() - firstWeekFirstDate.getTime()) / 86400000); - result = (roundFigure % 7 === 0) ? roundFigure / 7 : 1 + Math.round(roundFigure / 7); + result = (roundFigure % 7 === 0) ? roundFigure / 7 + 1 : 1 + Math.round(roundFigure / 7); if (result <= 0) { result = weeksInYear + result; }