mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-16 09:48:20 +01:00
fix: calendar tag displays wrong date at the final week of month in some case
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good
This commit is contained in:
parent
89b95b8a37
commit
9145f5d3d7
@ -251,6 +251,8 @@ namespace OS {
|
|||||||
];
|
];
|
||||||
const this_month = new Date(this._year, this._month, 1);
|
const this_month = new Date(this._year, this._month, 1);
|
||||||
const next_month = new Date(this._year, this._month + 1, 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.
|
// Find out when this month starts and ends.
|
||||||
const first_week_day = this_month.getDay();
|
const first_week_day = this_month.getDay();
|
||||||
const days_in_this_month = Math.round(
|
const days_in_this_month = Math.round(
|
||||||
@ -294,14 +296,11 @@ namespace OS {
|
|||||||
week_day++;
|
week_day++;
|
||||||
}
|
}
|
||||||
for (
|
for (
|
||||||
let i = 0, end2 = 7 - row.length, asc2 = 0 <= end2;
|
let i = 0; i < 7 - row.length; i++
|
||||||
asc2 ? i <= end2 : i >= end2;
|
|
||||||
asc2 ? i++ : i--
|
|
||||||
) {
|
) {
|
||||||
row.push({ text: "" });
|
row.push({ text: "" });
|
||||||
}
|
}
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
const grid = this.refs.grid as GridViewTag;
|
|
||||||
grid.rows = rows;
|
grid.rows = rows;
|
||||||
(this.refs.mlbl as LabelTag).text = `${
|
(this.refs.mlbl as LabelTag).text = `${
|
||||||
months[this._month]
|
months[this._month]
|
||||||
|
Loading…
Reference in New Issue
Block a user