From 771bb35e9ffd298f451607abf50aec06c1513ac7 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 10 Mar 2024 13:45:08 +0800 Subject: [PATCH] show the transaction time in default timezone by clicking the transaction time in mobile version transaction view page when the transaction time zone is not the default time zone --- src/views/mobile/transactions/EditPage.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/views/mobile/transactions/EditPage.vue b/src/views/mobile/transactions/EditPage.vue index c7864eba..b33d046b 100644 --- a/src/views/mobile/transactions/EditPage.vue +++ b/src/views/mobile/transactions/EditPage.vue @@ -216,10 +216,10 @@ @@ -358,6 +358,7 @@ import { getNameByKeyValue } from '@/lib/common.js'; import { + getTimezoneOffset, getTimezoneOffsetMinutes, getBrowserTimezoneOffsetMinutes, getUtcOffsetByUtcOffsetMinutes, @@ -393,6 +394,7 @@ export default { geoLocationStatus: null, submitting: false, isSupportGeoLocation: !!navigator.geolocation, + showTimeInDefaultTimezone: false, showGeoLocationActionSheet: false, showMoreActionSheet: false, showSourceAmountSheet: false, @@ -461,6 +463,9 @@ export default { return this.$t('Transfer In Amount') + ` (${amountRate})`; }, + currentTimezoneOffsetMinutes() { + return getTimezoneOffsetMinutes(this.settingsStore.appSettings.timeZone); + }, defaultCurrency() { return this.userStore.currentUserDefaultCurrency; }, @@ -539,7 +544,11 @@ export default { } }, transactionDisplayTime() { - return this.$locale.formatUnixTimeToLongDateTime(this.userStore, getActualUnixTimeForStore(this.transaction.time, getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes())) + if (this.mode !== 'view' || !this.showTimeInDefaultTimezone) { + return this.$locale.formatUnixTimeToLongDateTime(this.userStore, getActualUnixTimeForStore(this.transaction.time, getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes())) + } + + return `${this.$locale.formatUnixTimeToLongDateTime(this.userStore, getActualUnixTimeForStore(this.transaction.time, this.transaction.utcOffset, getBrowserTimezoneOffsetMinutes()))} (UTC${getTimezoneOffset(this.settingsStore.appSettings.timeZone)})`; }, transactionDisplayTimezone() { return `UTC${getUtcOffsetByUtcOffsetMinutes(this.transaction.utcOffset)}`;