diff --git a/docs/widgets.md b/docs/widgets.md index be7151e6..873fe020 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -110,7 +110,7 @@ A simple, live-updating time and date widget with time-zone support. All fields **`customCityName`** | `string` | _Optional_ | By default the city from the time-zone is shown, but setting this value will override that text **`hideDate`** | `boolean` | _Optional_ | If set to `true`, the date and city will not be shown. Defaults to `false` **`hideSeconds`** | `boolean` | _Optional_ | If set to `true`, seconds will not be shown. Defaults to `false` -**`use12Hour`** | `boolean` | _Optional_ | If set to `true`, 12 hour time will be displayed. Defaults to `false` +**`use12Hour`** | `boolean` | _Optional_ | If set to `true`, 12 hour time will be displayed. Defaults to the settings suggested by the current `format` and `timeZone` #### Example diff --git a/src/components/Widgets/Clock.vue b/src/components/Widgets/Clock.vue index d72eb1ab..9b238f45 100644 --- a/src/components/Widgets/Clock.vue +++ b/src/components/Widgets/Clock.vue @@ -40,7 +40,9 @@ export default { return !this.options.hideSeconds; }, use12Hour() { - return !this.options.use12Hour; + if (typeof this.options.use12Hour === "boolean") return this.options.use12Hour; + // this is the default, it gets computed by the DateTimeFormat implementation + return Intl.DateTimeFormat(this.timeFormat, { timeZone: this.timeZone, hour: 'numeric' }).resolvedOptions().hour12 ?? false; }, }, methods: {