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

Fix #3432 Recurring expenses spawn at UTC timing instead of local time #3570

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
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
@@ -1,10 +1,10 @@
package com.ivy.wallet.domain.action.viewmodel.home

import com.ivy.base.time.TimeProvider
import com.ivy.data.model.Transaction
import com.ivy.frp.action.FPAction
import com.ivy.frp.lambda
import com.ivy.frp.then
import com.ivy.legacy.utils.dateNowUTC
import com.ivy.wallet.domain.action.account.AccountByIdAct
import com.ivy.wallet.domain.action.exchange.ExchangeAct
import com.ivy.wallet.domain.action.exchange.actInput
Expand All @@ -22,14 +22,15 @@ import javax.inject.Inject
class DueTrnsInfoAct @Inject constructor(
private val dueTrnsAct: DueTrnsAct,
private val accountByIdAct: AccountByIdAct,
private val exchangeAct: ExchangeAct
private val exchangeAct: ExchangeAct,
private val timeProvider: TimeProvider
) : FPAction<DueTrnsInfoAct.Input, DueTrnsInfoAct.Output>() {

override suspend fun Input.compose(): suspend () -> Output =
suspend {
range
} then dueTrnsAct then { trns ->
val dateNow = dateNowUTC()
val dateNow = timeProvider.localDateNow()
trns.filter {
this.dueFilter(it, dateNow)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.data.model.IntervalType
import com.ivy.design.api.LocalTimeProvider
import com.ivy.design.l0_system.UI
import com.ivy.design.l0_system.style
import com.ivy.legacy.IvyWalletCtx
Expand All @@ -47,7 +48,6 @@ import com.ivy.legacy.utils.hideKeyboard
import com.ivy.legacy.utils.onScreenStart
import com.ivy.design.utils.thenIf
import com.ivy.legacy.utils.rememberInteractionSource
import com.ivy.legacy.utils.timeNowUTC
import com.ivy.ui.R
import com.ivy.wallet.ui.theme.Gradient
import com.ivy.wallet.ui.theme.GradientIvy
Expand Down Expand Up @@ -80,8 +80,9 @@ fun BoxWithConstraintsScope.RecurringRuleModal(
dismiss: () -> Unit,
onRuleChanged: (LocalDateTime, oneTime: Boolean, Int?, IntervalType?) -> Unit,
) {
val timeProvider = LocalTimeProvider.current
var startDate by remember(modal) {
mutableStateOf(modal?.initialStartDate ?: timeNowUTC())
mutableStateOf(modal?.initialStartDate ?: timeProvider.localNow())
}
var oneTime by remember(modal) {
mutableStateOf(modal?.initialOneTime ?: false)
Expand Down