Descuadre de meses componente calendar #1733
gitea/salix/master This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-10-31 13:18:29 +01:00
parent f752404ebe
commit dd17bb0386
2 changed files with 8 additions and 6 deletions

View File

@ -260,9 +260,9 @@ export default class Calendar extends Component {
*/
moveNext(skip = 1) {
let next = this.defaultDate.getMonth() + skip;
this.defaultDate.setMonth(next);
this.defaultDate.setHours(0, 0, 0, 0);
this.defaultDate.setDate(1);
this.defaultDate.setMonth(next);
this.repaint();
this.emit('moveNext');
@ -275,11 +275,10 @@ export default class Calendar extends Component {
*/
movePrevious(skip = 1) {
let previous = this.defaultDate.getMonth() - skip;
this.defaultDate.setMonth(previous);
this.defaultDate.setHours(0, 0, 0, 0);
this.defaultDate.setDate(1);
this.defaultDate.setMonth(previous);
const lastDate = this.lastDay(this.defaultDate);
this.defaultDate.setDate(lastDate.getDate());
this.repaint();
this.emit('movePrevious');

View File

@ -7,8 +7,11 @@ class Controller {
this.$scope = $scope;
this.$http = $http;
this.stMonthDate = new Date();
this.ndMonthDate = new Date();
this.ndMonthDate.setMonth(this.ndMonthDate.getMonth() + 1);
const ndMonth = new Date();
ndMonth.setDate(1);
ndMonth.setMonth(ndMonth.getMonth() + 1);
this.ndMonthDate = ndMonth;
}
$postLink() {