Skip to content

Commit

Permalink
release(1.0.3): release fix for period week number
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Ahsan Ayaz committed Apr 9, 2024
1 parent 5daae5d commit 4933396
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 29 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [1.0.3](https://github.com/IOMechs/angular-year-calendar/compare/v1.0.2...v1.0.3) (2024-04-09)


### Bug Fixes

* **period-week-number:** added testcase for the period week number calculations ([5daae5d](https://github.com/IOMechs/angular-year-calendar/commit/5daae5dc99e3a161f285a476f621c0608f9a484c))
* **period-week-number:** not using the current week startdate when force week set to true ([63161ee](https://github.com/IOMechs/angular-year-calendar/commit/63161ee223e259c254635999faa67634e540d9aa))



## [1.0.2](https://github.com/IOMechs/angular-year-calendar/compare/v1.0.1...v1.0.2) (2024-03-26)


Expand Down
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
"@angular-eslint/schematics",
"@angular-eslint/schematics",
"@angular-eslint/schematics"
]
],
"analytics": false
}
}
16 changes: 14 additions & 2 deletions docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,26 @@
<div class="content getting-started">
<div class="content-data">

<h2 id="101-2024-03-18"><a href="https://github.com/IOMechs/angular-year-calendar/compare/v1.0.0...v1.0.1">1.0.1</a> (2024-03-18)</h2>
<h2 id="102-2024-03-26"><a href="https://github.com/IOMechs/angular-year-calendar/compare/v1.0.1...v1.0.2">1.0.2</a> (2024-03-26)</h2>
<h3 id="bug-fixes">Bug Fixes</h3>
<ul>
<li><strong>comments:</strong> added comments against most of the operatiosn (<a href="https://github.com/IOMechs/angular-year-calendar/commit/40d5e307f9824dd12420686ced9b9911543005d1">40d5e30</a>)</li>
<li><strong>comments:</strong> updated var name (<a href="https://github.com/IOMechs/angular-year-calendar/commit/262d85f87da1585b268617c7ff22f93482543707">262d85f</a>)</li>
<li><strong>comments:</strong> using pakage instead of api path (<a href="https://github.com/IOMechs/angular-year-calendar/commit/143b6853715ab6612f789215c489a5b61dfaa13a">143b685</a>)</li>
</ul>
<h3 id="features">Features</h3>
<ul>
<li><strong>13-month-calendar:</strong> calculating period and week number over year week number if set true from configuration (<a href="https://github.com/IOMechs/angular-year-calendar/commit/2c11fd9775c623196c4d1bd50ef3c5c1f394a881">2c11fd9</a>)</li>
<li><strong>13-month-calendar:</strong> pr fixes (<a href="https://github.com/IOMechs/angular-year-calendar/commit/c0edf96e7326a549b801f833af01a26a9d1f4717">c0edf96</a>)</li>
</ul>
<h2 id="101-2024-03-18"><a href="https://github.com/IOMechs/angular-year-calendar/compare/v1.0.0...v1.0.1">1.0.1</a> (2024-03-18)</h2>
<h3 id="bug-fixes-1">Bug Fixes</h3>
<ul>
<li><strong>ci:</strong> use NodeJS v16.13 (<a href="https://github.com/IOMechs/angular-year-calendar/commit/e8e326a04b6637dbd284ac3174c8ead9c124cd09">e8e326a</a>)</li>
<li><strong>week-number-calculation:</strong> if year start day same as selected start day (<a href="https://github.com/IOMechs/angular-year-calendar/commit/8e0ca5c2edc9abf8a500d487e4e877681a55001b">8e0ca5c</a>)</li>
</ul>
<h1 id="100-2022-12-07"><a href="https://github.com/IOMechs/angular-year-calendar/compare/0.1.8...1.0.0">1.0.0</a> (2022-12-07)</h1>
<h3 id="bug-fixes-1">Bug Fixes</h3>
<h3 id="bug-fixes-2">Bug Fixes</h3>
<ul>
<li><strong>v15:</strong> fix v15 migration issues (<a href="https://github.com/IOMechs/angular-year-calendar/commit/aef5bdd2effb5b8e7bded5315f4860c4f077b106">aef5bdd</a>)</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/dependencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<li>
<b>@angular/router</b> : ^15.0.2</li>
<li>
<b>@iomechs/angular-year-calendar</b> : ^1.0.1</li>
<b>@iomechs/angular-year-calendar</b> : ^1.0.2</li>
<li>
<b>angular-cli-ghpages</b> : ^0.6.0</li>
<li>
Expand Down
4 changes: 2 additions & 2 deletions docs/js/search/search_index.js

Large diffs are not rendered by default.

38 changes: 24 additions & 14 deletions docs/pipes/WeekNumberPipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="146"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:146</a></div>
<div class="io-line">Defined in <a href="" data-line="156"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:156</a></div>
</td>
</tr>

Expand Down Expand Up @@ -180,8 +180,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="157"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:157</a></div>
<div class="io-line">Defined in <a href="" data-line="167"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:167</a></div>
</td>
</tr>

Expand Down Expand Up @@ -263,8 +263,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="150"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:150</a></div>
<div class="io-line">Defined in <a href="" data-line="160"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:160</a></div>
</td>
</tr>

Expand Down Expand Up @@ -344,8 +344,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="172"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:172</a></div>
<div class="io-line">Defined in <a href="" data-line="182"
class="link-to-prism">projects/angular-year-calendar/src/lib/pipes/week-number/week-number.pipe.ts:182</a></div>
</td>
</tr>

Expand Down Expand Up @@ -515,7 +515,14 @@ <h3 id="methods">
const dateClone &#x3D; new Date(date);
const millisecondsInADay &#x3D; 86400000;

const { firstWeekMonth, weekStartsOn, forceWeek, forceWeekDate } &#x3D; ycConfig;
const {
firstWeekMonth,
weekStartsOn,
forceWeek,
forceWeekDate,
periodWeekNumber,
} &#x3D; ycConfig;

let result;
if (
firstWeekMonth &#x3D;&#x3D;&#x3D; undefined ||
Expand Down Expand Up @@ -560,8 +567,8 @@ <h3 id="methods">
firstWeekFirstDate &#x3D; subDays(firstWeekFirstDate, customDateDay);
} else {
firstWeekFirstDate &#x3D; addWeeks(firstWeekFirstDate, firstWeekMonth.week);
firstWeekFirstDate.setHours(12, 0, 0, 0);
}
firstWeekFirstDate.setHours(12, 0, 0, 0);
dateDay &#x3D; this.getDayInView(dateClone, weekStartsOn);
currentWeekStartDate &#x3D; subDays(dateClone, dateDay);

Expand Down Expand Up @@ -606,10 +613,12 @@ <h3 id="methods">
}
}

if (ycConfig.periodWeekNumber) {
date.setHours(12, 0, 0, 0);
if (periodWeekNumber) {
// if forceWeek then use currentWeekStartDate instead of provided date
const currentYearStartDiff &#x3D;
(date.getTime() - firstWeekFirstDate.getTime()) / millisecondsInADay;
((forceWeek ? currentWeekStartDate : dateClone).getTime() -
firstWeekFirstDate.getTime()) /
millisecondsInADay;

// calculating period week number from range [1-4] using the week number calculated above
let week &#x3D; result &#x3D;&#x3D;&#x3D; 53 ? 1 : result;
Expand All @@ -623,7 +632,8 @@ <h3 id="methods">
const weekNumber &#x3D; week % 4 || 4;

const nextYearStartDiff &#x3D;
(nextYearFirstDate.getTime() - date.getTime()) / millisecondsInADay;
(nextYearFirstDate.getTime() - dateClone.getTime()) /
millisecondsInADay;

// calculation for the &quot;Adjustment Week&quot; if days remaining are in multiple of 7
if (nextYearStartDiff % 7 &#x3D;&#x3D;&#x3D; 0 &amp;&amp; nextYearStartDiff &lt;&#x3D; 35) {
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@angular/platform-browser": "^15.0.2",
"@angular/platform-browser-dynamic": "^15.0.2",
"@angular/router": "^15.0.2",
"@iomechs/angular-year-calendar": "^1.0.2",
"@iomechs/angular-year-calendar": "^1.0.3",
"angular-cli-ghpages": "^0.6.0",
"conventional-changelog-cli": "^2.0.31",
"date-fns": "^2.5.1",
Expand Down
2 changes: 1 addition & 1 deletion projects/angular-year-calendar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iomechs/angular-year-calendar",
"version": "1.0.2",
"version": "1.0.3",
"dependencies": {
"tslib": "^2.0.0"
},
Expand Down

0 comments on commit 4933396

Please sign in to comment.