@@ -21,6 +21,9 @@ import org.orbitmvi.orbit.syntax.simple.intent
2121import org.orbitmvi.orbit.syntax.simple.postSideEffect
2222import org.orbitmvi.orbit.syntax.simple.reduce
2323import java.io.File
24+ import java.text.SimpleDateFormat
25+ import java.util.Date
26+ import java.util.Locale
2427import javax.inject.Inject
2528
2629@HiltViewModel
@@ -39,12 +42,14 @@ class OCRDetailViewModel @Inject constructor(
3942
4043 fun init (document : DocumentEntity ? ) = intent {
4144 val receipt = document?.images?.first()?.receipt?.result
42- val paymentDateString = receipt?.paymentInfo?.date?.formatted.run {
43- " ${this ?.year ? : " " }${this ?.month ? : " " }${this ?.day ? : " " } "
44- }
45- val paymentTimeString = receipt?.paymentInfo?.time?.formatted.run {
46- " ${this ?.hour ? : " " }${this ?.minute ? : " " }${this ?.second ? : " " } "
47- }
45+ val currentDate = SimpleDateFormat (" yyyyMMdd" , Locale .KOREA ).format(Date (System .currentTimeMillis()))
46+ val currentTime = SimpleDateFormat (" HHmmss" , Locale .KOREA ).format(Date (System .currentTimeMillis()))
47+ val paymentDateString = receipt?.paymentInfo?.date?.let {
48+ " ${it.formatted?.year} 년 ${it.formatted?.month} 월 ${it.formatted?.day} 일"
49+ } ? : currentDate
50+ val paymentTimeString = receipt?.paymentInfo?.time?.let {
51+ " ${it.formatted?.hour} :${it.formatted?.minute} :${it.formatted?.second} "
52+ } ? : currentTime
4853 reduce {
4954 state.copy(
5055 document = document,
@@ -77,7 +82,7 @@ class OCRDetailViewModel @Inject constructor(
7782 id = state.agencyId,
7883 storeInfo = state.storeNameValue.text,
7984 fundType = state.fundType,
80- amount = state.totalPriceValue.text.toInt(),
85+ amount = state.totalPriceValue.text.replace( " . " , " " ). toInt(),
8186 description = state.memoValue.text,
8287 paymentDate = state.postPaymentDate,
8388 receiptImageUrls = state.receiptImageUrls,
0 commit comments