Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Fix Incorrect Time Display After Saving Transaction #3433

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.ivy.base.legacy.SharedPrefs
import com.ivy.base.legacy.Transaction
import com.ivy.base.legacy.refreshWidget
import com.ivy.base.model.TransactionType
import com.ivy.base.time.TimeProvider
import com.ivy.data.db.dao.read.LoanDao
import com.ivy.data.db.dao.read.SettingsDao
import com.ivy.data.model.Category
Expand All @@ -37,7 +38,6 @@ import com.ivy.legacy.utils.dateNowLocal
import com.ivy.legacy.utils.getTrueDate
import com.ivy.legacy.utils.ioThread
import com.ivy.legacy.utils.timeNowLocal
import com.ivy.legacy.utils.timeNowUTC
import com.ivy.legacy.utils.timeUTC
import com.ivy.legacy.utils.toLowerCaseLocal
import com.ivy.legacy.utils.uiThread
Expand Down Expand Up @@ -107,7 +107,8 @@ class EditTransactionViewModel @Inject constructor(
private val transactionMapper: TransactionMapper,
private val tagRepository: TagRepository,
private val tagMapper: TagMapper,
private val features: Features
private val features: Features,
private val timeProvider: TimeProvider
) : ComposeViewModel<EditTransactionState, EditTransactionEvent>() {

private val transactionType = mutableStateOf(TransactionType.EXPENSE)
Expand Down Expand Up @@ -704,7 +705,7 @@ class EditTransactionViewModel @Inject constructor(
dateTime = when {
loadedTransaction().dateTime == null &&
dueDate.value == null -> {
timeNowUTC()
timeProvider.utcNow().atZone(timeProvider.getZoneId()).toLocalDateTime()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it, the date is showing correctly after saving the transaction but the is issue in the balance calculation. the balance didnt get updated for me...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @akashs056! Much appreciated that you tested πŸ™Œ

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akashs056 thanks for pointing it out.

}

else -> loadedTransaction().dateTime
Expand Down