From 2c64dfe00d7d83de4015b30266792a6ea09ee895 Mon Sep 17 00:00:00 2001 From: DanyLE Date: Mon, 6 Mar 2023 11:53:39 +0100 Subject: [PATCH] fix: calendar tag displays wrong date at the final week of month in some case --- src/core/tags/CalendarTag.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/tags/CalendarTag.ts b/src/core/tags/CalendarTag.ts index 4e173be..61e0943 100644 --- a/src/core/tags/CalendarTag.ts +++ b/src/core/tags/CalendarTag.ts @@ -251,6 +251,8 @@ namespace OS { ]; const this_month = new Date(this._year, this._month, 1); const next_month = new Date(this._year, this._month + 1, 1); + const grid = this.refs.grid as GridViewTag; + grid.rows = []; // Find out when this month starts and ends. const first_week_day = this_month.getDay(); const days_in_this_month = Math.round( @@ -294,14 +296,11 @@ namespace OS { week_day++; } for ( - let i = 0, end2 = 7 - row.length, asc2 = 0 <= end2; - asc2 ? i <= end2 : i >= end2; - asc2 ? i++ : i-- + let i = 0; i < 7 - row.length; i++ ) { row.push({ text: "" }); } rows.push(row); - const grid = this.refs.grid as GridViewTag; grid.rows = rows; (this.refs.mlbl as LabelTag).text = `${ months[this._month]