💬 Adds option for clock to have customCityName (#402)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="clock">
|
||||
<div class="upper" v-if="!options.hideDate">
|
||||
<p class="city">{{ timeZone | getCity }}</p>
|
||||
<p class="city">{{ cityName }}</p>
|
||||
<p class="date">{{ date }}</p>
|
||||
</div>
|
||||
<p class="time">{{ time }}</p>
|
||||
@@ -31,11 +31,10 @@ export default {
|
||||
if (this.options.format) return this.options.format;
|
||||
return navigator.language;
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
/* For a given time zone, return just the city name */
|
||||
getCity(timeZone) {
|
||||
return timeZone.split('/')[1].replaceAll('_', ' ');
|
||||
/* Get city name from time-zone, or return users custom city name */
|
||||
cityName() {
|
||||
if (this.options.customCityName) return this.options.customCityName;
|
||||
return this.timeZone.split('/')[1].replaceAll('_', ' ');
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user