mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 01:18:21 +01:00
fix: calendar tag displays wrong date at the final week of month in some case
This commit is contained in:
parent
1d1218acbd
commit
2c64dfe00d
@ -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