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

Commit

Permalink
use timeconverter API
Browse files Browse the repository at this point in the history
  • Loading branch information
akashs056 committed Aug 30, 2024
1 parent 68f455a commit 5d72f9a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.net.Uri
import arrow.core.Either
import com.ivy.base.model.TransactionType
import com.ivy.base.threading.DispatchersProvider
import com.ivy.base.time.TimeConverter
import com.ivy.base.time.TimeProvider
import com.ivy.data.file.FileSystem
import com.ivy.data.model.Account
Expand Down Expand Up @@ -35,7 +36,8 @@ class ExportCsvUseCase @Inject constructor(
private val transactionRepository: TransactionRepository,
private val dispatchers: DispatchersProvider,
private val fileSystem: FileSystem,
private val timeProvider: TimeProvider
private val timeProvider: TimeProvider,
private val timeConverter: TimeConverter
) {

suspend fun exportToFile(
Expand Down Expand Up @@ -189,8 +191,9 @@ class ExportCsvUseCase @Inject constructor(
)

private fun Instant.csvFormat(): String {
return this.atZone(timeProvider.getZoneId())
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
return with(timeConverter) {
this@csvFormat.toLocalDateTime()
}.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
}

private fun Double.csvFormat(): String = DecimalFormat(NUMBER_FORMAT).apply {
Expand Down

0 comments on commit 5d72f9a

Please sign in to comment.