💬 Adds option for clock to have customCityName (#402)
This commit is contained in:
parent
1c8021964b
commit
d516bb02fa
2 changed files with 6 additions and 6 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue