Skip to content

Commit

Permalink
- Fixed: Dropdown dates setting bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesb committed Oct 2, 2021
1 parent 1bc6354 commit 471c8af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion data.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"today": "today",
"tomorrow": "tomorrow",
"in two days": "in two days",
"next week": "next week"
"next week": "next week",
"in two weeks": "in two weeks"
}
}
20 changes: 10 additions & 10 deletions src/views/settings-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ export class IWSettingsTab extends PluginSettingTab {
return;
}

const validDates = inputDates
.filter(([_, date]) => date != null && date.date)
.map(([s, _]) => s);
const validDates: string[] = inputDates
.filter(([_, date]: [string, any]) => date != null && date.date)
.map(([s, _]: [string, Date]) => s);

if (inputDates.length !== validDates.length) {
LogTo.Debug(
Expand All @@ -134,13 +134,13 @@ export class IWSettingsTab extends PluginSettingTab {
);
}

const dateOptionsRecord: Record<
string,
string
> = validDates.reduce(
(acc: Record<string, string>, x: string) => (acc[x] = x),
{}
);
const dateOptionsRecord: Record<string, string> = validDates
.reduce((acc, x) =>
{
acc[x] = x;
return acc;
}, {} as Record<string, string>);

LogTo.Debug(
"Setting dropdown date options to " +
JSON.stringify(dateOptionsRecord)
Expand Down

0 comments on commit 471c8af

Please sign in to comment.