Skip to content

Commit 471c8af

Browse files
author
jamesb
committed
- Fixed: Dropdown dates setting bugs.
1 parent 1bc6354 commit 471c8af

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

Diff for: data.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"today": "today",
1818
"tomorrow": "tomorrow",
1919
"in two days": "in two days",
20-
"next week": "next week"
20+
"next week": "next week",
21+
"in two weeks": "in two weeks"
2122
}
2223
}

Diff for: src/views/settings-tab.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ export class IWSettingsTab extends PluginSettingTab {
122122
return;
123123
}
124124

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

129129
if (inputDates.length !== validDates.length) {
130130
LogTo.Debug(
@@ -134,13 +134,13 @@ export class IWSettingsTab extends PluginSettingTab {
134134
);
135135
}
136136

137-
const dateOptionsRecord: Record<
138-
string,
139-
string
140-
> = validDates.reduce(
141-
(acc: Record<string, string>, x: string) => (acc[x] = x),
142-
{}
143-
);
137+
const dateOptionsRecord: Record<string, string> = validDates
138+
.reduce((acc, x) =>
139+
{
140+
acc[x] = x;
141+
return acc;
142+
}, {} as Record<string, string>);
143+
144144
LogTo.Debug(
145145
"Setting dropdown date options to " +
146146
JSON.stringify(dateOptionsRecord)

0 commit comments

Comments
 (0)