Skip to content

Commit

Permalink
[FEAT/#34] 데이트피커 결과값 저장
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Sep 1, 2024
1 parent 3f8d373 commit 61f5151
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<BottomSheetSellDateBinding>(R.layout.bottom_sheet_sell_date) {
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SellProgressViewModel
var productId = ""
var isAccountExist = false

var sellDate = ""

private val _getProductState = MutableStateFlow<UiState<SellProductModel>>(UiState.Empty)
val getProductState: StateFlow<UiState<SellProductModel>> = _getProductState

Expand Down

0 comments on commit 61f5151

Please sign in to comment.