mirror of https://github.com/Lissy93/dashy.git
🔀 Merge pull request #982 from Totto16/master
- Clock Widget: fix bug, better default Handling for: use12Hour, showSeconds
This commit is contained in:
commit
475a9a1469
|
@ -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
|
**`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`
|
**`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`
|
**`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
|
#### Example
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,9 @@ export default {
|
||||||
return !this.options.hideSeconds;
|
return !this.options.hideSeconds;
|
||||||
},
|
},
|
||||||
use12Hour() {
|
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: {
|
methods: {
|
||||||
|
|
Loading…
Reference in New Issue