fixed calendar widget when open in a non-date note

This commit is contained in:
zadam
2021-07-05 15:50:21 +02:00
parent e2819109e9
commit 9adf4d7e8e
2 changed files with 15 additions and 10 deletions

View File

@@ -86,9 +86,10 @@ export default class CalendarMenuWidget extends BasicWidget {
}
init($el, activeDate) {
this.activeDate = new Date(activeDate + "T12:00:00"); // attaching time fixes local timezone handling
// attaching time fixes local timezone handling
this.activeDate = activeDate ? new Date(activeDate + "T12:00:00") : null;
this.todaysDate = new Date();
this.date = new Date(this.activeDate.getTime());
this.date = new Date((this.activeDate || this.todaysDate).getTime());
this.date.setDate(1);
this.createMonth();
@@ -129,6 +130,10 @@ export default class CalendarMenuWidget extends BasicWidget {
}
isEqual(a, b) {
if (!a && b || a && !b) {
return false;
}
return a.getFullYear() === b.getFullYear()
&& a.getMonth() === b.getMonth()
&& a.getDate() === b.getDate();