mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-23 21:55:30 +02:00
🔀 Merge pull request #934 from rtm516/feature/12h-clock
Add 12 hour option to clock widget
This commit is contained in:
commit
29eb5d8545
@ -110,6 +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`
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
|
@ -39,6 +39,9 @@ export default {
|
|||||||
showSeconds() {
|
showSeconds() {
|
||||||
return !this.options.hideSeconds;
|
return !this.options.hideSeconds;
|
||||||
},
|
},
|
||||||
|
use12Hour() {
|
||||||
|
return !this.options.use12Hour;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
update() {
|
update() {
|
||||||
@ -52,6 +55,7 @@ export default {
|
|||||||
hour: 'numeric',
|
hour: 'numeric',
|
||||||
minute: 'numeric',
|
minute: 'numeric',
|
||||||
...(this.showSeconds && { second: 'numeric' }),
|
...(this.showSeconds && { second: 'numeric' }),
|
||||||
|
...(this.use12Hour && { hourCycle: 'h12' }),
|
||||||
}).format();
|
}).format();
|
||||||
},
|
},
|
||||||
/* Get and format the date */
|
/* Get and format the date */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user