diff --git a/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt b/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt index a98428d7..3bab71b4 100644 --- a/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt +++ b/presentation/src/main/java/co/orange/presentation/sell/progress/SellDateBottomSheet.kt @@ -7,7 +7,9 @@ import co.orange.core.base.BaseBottomSheet import co.orange.core.extension.setOnSingleClickListener import kr.genti.presentation.R import kr.genti.presentation.databinding.BottomSheetSellDateBinding +import java.text.SimpleDateFormat import java.util.Calendar +import java.util.Locale class SellDateBottomSheet : BaseBottomSheet(R.layout.bottom_sheet_sell_date) { @@ -29,9 +31,21 @@ class SellDateBottomSheet : } private fun initSubmitBtnListener() { - binding.btnSubmit.setOnSingleClickListener { } + binding.btnSubmit.setOnSingleClickListener { + viewModel.sellDate = getDateFromDatePicker() + dismiss() + } } + private fun getDateFromDatePicker(): String = + with(binding.dpSell) { + SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format( + Calendar.getInstance().apply { + set(year, month, dayOfMonth) + }.time, + ) + } + private fun setDatePicker() { binding.dpSell.apply { val calendar = Calendar.getInstance() diff --git a/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt b/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt index 3d67ecf3..1c2d25a9 100644 --- a/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt +++ b/presentation/src/main/java/co/orange/presentation/sell/progress/SellProgressViewModel.kt @@ -20,6 +20,8 @@ class SellProgressViewModel var productId = "" var isAccountExist = false + var sellDate = "" + private val _getProductState = MutableStateFlow>(UiState.Empty) val getProductState: StateFlow> = _getProductState