Skip to content

Commit 4287092

Browse files
committed
✨ Option to hide seconds in Clock (#644)
1 parent bcb1b70 commit 4287092

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/widgets.md

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ A simple, live-updating time and date widget with time-zone support. All fields
9797
**`format`** | `string` | _Optional_ | A country code for displaying the date and time in local format.<br>Specified as `[ISO-3166]-[ISO-639]`, for example: `en-AU`. See [here](https://www.fincher.org/Utilities/CountryLanguageList.shtml) for a full list of locales. Defaults to the browser / device's region
9898
**`customCityName`** | `string` | _Optional_ | By default the city from the time-zone is shown, but setting this value will override that text
9999
**`hideDate`** | `boolean` | _Optional_ | If set to `true`, the date and city will not be shown. Defaults to `false`
100+
**`hideSeconds`** | `boolean` | _Optional_ | If set to `true`, seconds will not be shown. Defaults to `false`
100101

101102
##### Example
102103

src/components/Widgets/Clock.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export default {
3636
if (this.options.customCityName) return this.options.customCityName;
3737
return this.timeZone.split('/')[1].replaceAll('_', ' ');
3838
},
39+
showSeconds() {
40+
return !this.options.hideSeconds;
41+
},
3942
},
4043
methods: {
4144
update() {
@@ -48,7 +51,7 @@ export default {
4851
timeZone: this.timeZone,
4952
hour: 'numeric',
5053
minute: 'numeric',
51-
second: 'numeric',
54+
...(this.showSeconds && { second: 'numeric' }),
5255
}).format();
5356
},
5457
/* Get and format the date */

0 commit comments

Comments
 (0)