fix default time is wrong in add transaction dialog when default time zone is not the browser time zone in desktop version
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
getFirstAvaiableSubCategoryId
|
||||
} from './category.js';
|
||||
|
||||
export function setTransactionModelByTransaction(transaction, transaction2, allCategories, allCategoriesMap, allVisibleAccounts, allAccountsMap, defaultAccountId, options, setContextData) {
|
||||
export function setTransactionModelByTransaction(transaction, transaction2, allCategories, allCategoriesMap, allVisibleAccounts, allAccountsMap, defaultAccountId, options, setContextData, convertContextTime) {
|
||||
if ((!options.type || options.type === '0') && options.categoryId && options.categoryId !== '0' && allCategoriesMap[options.categoryId]) {
|
||||
const category = allCategoriesMap[options.categoryId];
|
||||
const type = categoryTypeToTransactionType(category.type);
|
||||
@@ -115,7 +115,12 @@ export function setTransactionModelByTransaction(transaction, transaction2, allC
|
||||
if (setContextData) {
|
||||
transaction.utcOffset = transaction2.utcOffset;
|
||||
transaction.timeZone = transaction2.timeZone;
|
||||
transaction.time = getDummyUnixTimeForLocalUsage(transaction2.time, transaction.utcOffset, getBrowserTimezoneOffsetMinutes());
|
||||
|
||||
if (convertContextTime) {
|
||||
transaction.time = getDummyUnixTimeForLocalUsage(transaction2.time, transaction.utcOffset, getBrowserTimezoneOffsetMinutes());
|
||||
} else {
|
||||
transaction.time = transaction2.time;
|
||||
}
|
||||
}
|
||||
|
||||
transaction.sourceAccountId = transaction2.sourceAccountId;
|
||||
|
||||
@@ -614,7 +614,7 @@ export default {
|
||||
self.originalTransactionEditable = false;
|
||||
|
||||
const newTransaction = self.transactionsStore.generateNewTransactionModel(options.type);
|
||||
self.setTransaction(newTransaction, options, true);
|
||||
self.setTransaction(newTransaction, options, true, false);
|
||||
|
||||
const promises = [
|
||||
self.accountsStore.loadAllAccounts({ force: false }),
|
||||
@@ -624,7 +624,7 @@ export default {
|
||||
|
||||
if (options && options.id) {
|
||||
if (options.currentTransaction) {
|
||||
self.setTransaction(options.currentTransaction, options, true);
|
||||
self.setTransaction(options.currentTransaction, options, true, true);
|
||||
}
|
||||
|
||||
self.mode = 'view';
|
||||
@@ -658,10 +658,10 @@ export default {
|
||||
|
||||
if (options.id && responses[3]) {
|
||||
const transaction = responses[3];
|
||||
self.setTransaction(transaction, options, true);
|
||||
self.setTransaction(transaction, options, true, true);
|
||||
self.originalTransactionEditable = transaction.editable;
|
||||
} else {
|
||||
self.setTransaction(null, options, true);
|
||||
self.setTransaction(null, options, true, true);
|
||||
}
|
||||
|
||||
self.loading = false;
|
||||
@@ -837,7 +837,7 @@ export default {
|
||||
this.transaction.destinationAmount = oldSourceAmount;
|
||||
}
|
||||
},
|
||||
setTransaction(transaction, options, setContextData) {
|
||||
setTransaction(transaction, options, setContextData, convertContextTime) {
|
||||
setTransactionModelByTransaction(
|
||||
this.transaction,
|
||||
transaction,
|
||||
@@ -851,7 +851,8 @@ export default {
|
||||
categoryId: options.categoryId,
|
||||
accountId: options.accountId
|
||||
},
|
||||
setContextData
|
||||
setContextData,
|
||||
convertContextTime
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -677,6 +677,7 @@ export default {
|
||||
categoryId: query.categoryId,
|
||||
accountId: query.accountId
|
||||
},
|
||||
(self.mode === 'edit' || self.mode === 'view'),
|
||||
(self.mode === 'edit' || self.mode === 'view')
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user