diff --git a/src/common/user-store.ts b/src/common/user-store.ts index 4622b84312..510427a88e 100644 --- a/src/common/user-store.ts +++ b/src/common/user-store.ts @@ -56,7 +56,7 @@ export class UserStore extends BaseStore { allowTelemetry: true, allowUntrustedCAs: false, colorTheme: UserStore.defaultTheme, - localeTimezone: moment.tz.guess(true), + localeTimezone: moment.tz.guess(true) || "UTC", downloadMirror: "default", downloadKubectlBinaries: true, // Download kubectl binaries matching cluster version openAtLogin: false, @@ -133,6 +133,11 @@ export class UserStore extends BaseStore { this.lastSeenAppVersion = getAppVersion(); } + @action + setLocaleTimezone(tz: string) { + this.preferences.localeTimezone = tz; + } + protected refreshNewContexts = async () => { try { const kubeConfig = await readFile(this.kubeConfigPath, "utf8"); diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index c6f0c7f2ab..06590fbe90 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -41,12 +41,10 @@ export class Preferences extends React.Component { })); } - @computed get timezoneOptions(): SelectOption[] { - return moment.tz.names().map(zone => ({ - label: zone, - value: zone, - })); - } + timezoneOptions: SelectOption[] = moment.tz.names().map(zone => ({ + label: zone, + value: zone, + })); componentDidMount() { disposeOnUnmount(this, [ @@ -169,7 +167,7 @@ export class Preferences extends React.Component {