fix some bugs

This commit is contained in:
FReenen
2023-11-29 21:32:01 +01:00
parent 795fe162c5
commit 66ce7ddfbf
2 changed files with 8 additions and 8 deletions

16
main.js
View File

@@ -134,12 +134,12 @@ function scanFile(editor, data)
res = [...line.matchAll("\\[(" + DateFormat.date + "(?:-" + DateFormat.date + ")?)\\]")]; res = [...line.matchAll("\\[(" + DateFormat.date + "(?:-" + DateFormat.date + ")?)\\]")];
if (res.length > 0) if (res.length > 0)
{ {
if ((res[0] == "[-]" && res.length > 1) || res[0] != "[-]") if (res[0][0] == "[-]" && res.length > 1)
{
res[0] = res[1];
}
if (res[0][0] != "[-]")
{ {
if (res[0][0] == "[-]")
{
res[0] = res[1];
}
res = res[0] res = res[0]
res[1] = parseDate(res[1], defal); res[1] = parseDate(res[1], defal);
let procesed = processLine(line, line.replace(res[0], ''), res[1], data); let procesed = processLine(line, line.replace(res[0], ''), res[1], data);
@@ -432,7 +432,7 @@ class CalendarView extends ItemView
{ {
let day = date[0].day() - 1 let day = date[0].day() - 1
day = (day == -1) ? 6 : day; day = (day == -1) ? 6 : day;
if (event.date.match(DateFormat.time) == '12:00am') if (event.date.match(DateFormat.time)[0] == '12:00am')
{ {
this.renderEvent(event, this.allday[day]); this.renderEvent(event, this.allday[day]);
} }
@@ -446,7 +446,7 @@ class CalendarView extends ItemView
renderEvent(event, container) renderEvent(event, container)
{ {
el = container.createEl('div', { let el = container.createEl('div', {
cls: 'frcal__event', cls: 'frcal__event',
id: "fr_event_" + event.id, id: "fr_event_" + event.id,
attr: { attr: {
@@ -516,7 +516,7 @@ class FRCalander extends Plugin
app.workspace.setActiveLeaf(leaf); app.workspace.setActiveLeaf(leaf);
}); });
this.data = this.loadData(); this.data = await this.loadData();
} }
} }