moveNext() movePrevious() moves now to day 1 to prevent a month jump
gitea/salix/dev This commit has test failures Details

This commit is contained in:
Joan Sanchez 2019-05-31 13:28:28 +02:00
parent 5d8e9771d7
commit 68f67f12d7
2 changed files with 3 additions and 1 deletions

View File

@ -225,6 +225,7 @@ export default class Calendar extends Component {
*/
moveNext(skip = 1) {
let next = this.defaultDate.getMonth() + skip;
this.defaultDate.setDate(1);
this.defaultDate.setMonth(next);
this.repaint();
@ -238,6 +239,7 @@ export default class Calendar extends Component {
*/
movePrevious(skip = 1) {
let previous = this.defaultDate.getMonth() - skip;
this.defaultDate.setDate(1);
this.defaultDate.setMonth(previous);
this.repaint();

View File

@ -98,8 +98,8 @@ class Controller {
for (let i = 0; i < months.length; i++) {
const now = new Date();
now.setHours(0, 0, 0, 0);
now.setMonth(i);
now.setDate(1);
now.setMonth(i);
months[i] = now;
}