Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:sparkles: Option to hide seconds in Clock (#644)

Alicia Sykes4287092ea29d
diff --git a/docs/widgets.md b/docs/widgets.md
index 02f2d13d..8cb9d474 100644
--- a/docs/widgets.md
+++ b/docs/widgets.md
@@ -97,6 +97,7 @@ A simple, live-updating time and date widget with time-zone support. All fields
**`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
**`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`
##### Example
diff --git a/src/components/Widgets/Clock.vue b/src/components/Widgets/Clock.vue
index aa5ccc51..717bad62 100644
--- a/src/components/Widgets/Clock.vue
+++ b/src/components/Widgets/Clock.vue
@@ -36,6 +36,9 @@ export default {
if (this.options.customCityName) return this.options.customCityName;
return this.timeZone.split('/')[1].replaceAll('_', ' ');
},
+ showSeconds() {
+ return !this.options.hideSeconds;
+ },
},
methods: {
update() {
@@ -48,7 +51,7 @@ export default {
timeZone: this.timeZone,
hour: 'numeric',
minute: 'numeric',
- second: 'numeric',
+ ...(this.showSeconds && { second: 'numeric' }),
}).format();
},
/* Get and format the date */