Skip to content

Commit

Permalink
Remove trim() from settings onchange
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcain committed Apr 30, 2021
1 parent d2e61a5 commit 5667e12
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ export class NLDSettingsTab extends PluginSettingTab {
.setDefaultFormat("YYYY-MM-DD")
.setValue(this.plugin.settings.format)
.onChange(async (value) => {
if (value === "") {
this.plugin.settings.format = "YYYY-MM-DD";
} else {
this.plugin.settings.format = value.trim();
}
this.plugin.settings.format = value || "YYYY-MM-DD";
await this.plugin.saveSettings();
})
);
Expand All @@ -78,7 +74,7 @@ export class NLDSettingsTab extends PluginSettingTab {
.addOption("Sunday", "Sunday")
.setValue(this.plugin.settings.weekStart)
.onChange(async (value) => {
this.plugin.settings.weekStart = value.trim();
this.plugin.settings.weekStart = value;
await this.plugin.saveSettings();
})
);
Expand All @@ -95,11 +91,7 @@ export class NLDSettingsTab extends PluginSettingTab {
.setDefaultFormat("HH:mm")
.setValue(this.plugin.settings.timeFormat)
.onChange(async (value) => {
if (value === "") {
this.plugin.settings.timeFormat = "HH:mm";
} else {
this.plugin.settings.timeFormat = value.trim();
}
this.plugin.settings.timeFormat = value || "HH:mm";
await this.plugin.saveSettings();
})
);
Expand Down

0 comments on commit 5667e12

Please sign in to comment.