mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
support set timezone
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<f7-list-item
|
||||
:key="currentLocale + '_lang'"
|
||||
:title="$t('Language')"
|
||||
smart-select :smart-select-params="{ openIn: 'sheet', closeOnSelect: true, sheetCloseLinkText: $t('Done') }">
|
||||
smart-select :smart-select-params="{ openIn: 'sheet', closeOnSelect: true, sheetCloseLinkText: $t('Done'), scrollToSelectedItem: true }">
|
||||
<select v-model="currentLocale">
|
||||
<option v-for="(lang, locale) in allLanguages"
|
||||
:key="locale"
|
||||
@@ -32,6 +32,17 @@
|
||||
</select>
|
||||
</f7-list-item>
|
||||
|
||||
<f7-list-item
|
||||
:title="$t('Timezone')"
|
||||
smart-select :smart-select-params="{ openIn: 'popup', searchbar: true, searchbarPlaceholder: $t('Timezone'), searchbarDisableText: $t('Cancel'), closeOnSelect: true, popupCloseLinkText: $t('Done'), scrollToSelectedItem: true }">
|
||||
<select v-model="currentTimezone">
|
||||
<option value="">{{ `(UTC${defaultTimezoneOffset}) ${$t('System Default')}` }}</option>
|
||||
<option v-for="timezone in allTimezones"
|
||||
:key="timezone.name"
|
||||
:value="timezone.name">{{ timezone.displayName }}</option>
|
||||
</select>
|
||||
</f7-list-item>
|
||||
|
||||
<f7-list-item :title="$t('Application Lock')" :after="isEnableApplicationLock ? $t('Enabled') : $t('Disabled')" link="/app_lock"></f7-list-item>
|
||||
|
||||
<f7-list-item :title="$t('Exchange Rates Data')" :after="exchangeRatesLastUpdateDate" link="/exchange_rates"></f7-list-item>
|
||||
@@ -104,6 +115,12 @@ export default {
|
||||
allLanguages() {
|
||||
return this.$locale.getAllLanguages();
|
||||
},
|
||||
allTimezones() {
|
||||
return this.$locale.getAllTimezones();
|
||||
},
|
||||
defaultTimezoneOffset() {
|
||||
return this.$locale.defaultTimezoneOffset;
|
||||
},
|
||||
currentLocale: {
|
||||
get: function () {
|
||||
return this.$i18n.locale;
|
||||
@@ -112,6 +129,14 @@ export default {
|
||||
this.$locale.setLanguage(value);
|
||||
}
|
||||
},
|
||||
currentTimezone: {
|
||||
get: function () {
|
||||
return this.$locale.getTimezone();
|
||||
},
|
||||
set: function (value) {
|
||||
this.$locale.setTimezone(value);
|
||||
}
|
||||
},
|
||||
currentNickName() {
|
||||
return this.$store.getters.currentUserNickname || this.$t('User');
|
||||
},
|
||||
@@ -119,8 +144,8 @@ export default {
|
||||
return this.$settings.isDataExportingEnabled();
|
||||
},
|
||||
exchangeRatesLastUpdateDate() {
|
||||
const exchangeRatesLastUpdateDate = this.$store.getters.exchangeRatesLastUpdateDate;
|
||||
return exchangeRatesLastUpdateDate ? this.$utilities.formatDate(exchangeRatesLastUpdateDate, this.$t('format.date.long')) : '';
|
||||
const exchangeRatesLastUpdateTime = this.$store.getters.exchangeRatesLastUpdateTime;
|
||||
return exchangeRatesLastUpdateTime ? this.$utilities.formatUnixTime(exchangeRatesLastUpdateTime, this.$t('format.date.long')) : '';
|
||||
},
|
||||
isAutoUpdateExchangeRatesData: {
|
||||
get: function () {
|
||||
|
||||
@@ -250,7 +250,7 @@ export default {
|
||||
data() {
|
||||
const self = this;
|
||||
const query = self.$f7route.query;
|
||||
const now = new Date();
|
||||
const now = self.$utilities.getCurrentUnixTime();
|
||||
|
||||
let defaultType = self.$constants.transaction.allTransactionTypes.Expense;
|
||||
|
||||
@@ -265,8 +265,8 @@ export default {
|
||||
editTransactionId: null,
|
||||
transaction: {
|
||||
type: defaultType,
|
||||
unixTime: self.$utilities.getUnixTime(now),
|
||||
time: self.$utilities.formatDate(now, 'YYYY-MM-DDTHH:mm'),
|
||||
unixTime: now,
|
||||
time: self.$utilities.formatUnixTime(now, 'YYYY-MM-DDTHH:mm'),
|
||||
expenseCategory: '',
|
||||
incomeCategory: '',
|
||||
transferCategory: '',
|
||||
@@ -488,7 +488,7 @@ export default {
|
||||
},
|
||||
'transaction.time': function (newValue) {
|
||||
if (!newValue) {
|
||||
newValue = this.$utilities.formatDate(new Date(), 'YYYY-MM-DDTHH:mm');
|
||||
newValue = this.$utilities.formatUnixTime(this.$utilities.getCurrentUnixTime(), 'YYYY-MM-DDTHH:mm');
|
||||
this.transaction.time = newValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user