Skip to content

A platform for community discussion. Free, open, simple.

DEV: Prefer kvs over raw localStorage (#17907)

Jarek Radoszf25e77922684
diff --git a/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js b/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js
index ad8da0313f2..a7597ec88d1 100644
--- a/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js
+++ b/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js
@@ -127,8 +127,8 @@ export default Component.extend({
},
_loadLastUsedCustomDatetime() {
- let lastTime = localStorage.lastCustomTime;
- let lastDate = localStorage.lastCustomDate;
+ const lastTime = this.keyValueStore.lastCustomTime;
+ const lastDate = this.keyValueStore.lastCustomDate;
if (lastTime && lastDate) {
let parsed = parseCustomDatetime(lastDate, lastTime, this.userTimezone);
@@ -242,8 +242,8 @@ export default Component.extend({
if (customDatetime.isValid() && this.customDate) {
dateTime = customDatetime;
- localStorage.lastCustomTime = this.customTime;
- localStorage.lastCustomDate = this.customDate;
+ this.keyValueStore.lastCustomTime = this.customTime;
+ this.keyValueStore.lastCustomDate = this.customDate;
}
} else {
dateTime = this.options.findBy("id", type).time;