Skip to content

Commit

Permalink
Fix date not picking value/ exact formatted date in dd-mm-yyyy
Browse files Browse the repository at this point in the history
  • Loading branch information
MuindiStephen committed Sep 17, 2024
1 parent 21cae71 commit 295b9ba
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.steve_md.smartmkulima.R
import com.steve_md.smartmkulima.databinding.FragmentCropCycleAddNewExpensesBinding
import com.steve_md.smartmkulima.model.NewFarmField
import com.steve_md.smartmkulima.model.financialdata.FarmFinanceExpenseRecords
import com.steve_md.smartmkulima.utils.DateFormat
import com.steve_md.smartmkulima.utils.displaySnackBar
import com.steve_md.smartmkulima.viewmodel.MainViewModel
import dagger.hilt.android.AndroidEntryPoint
Expand Down Expand Up @@ -73,7 +74,7 @@ class CropCycleAddNewExpensesFragment : Fragment() {
// Update the selected date in the UI
expenseDay?.set(selectedYear, selectedMonth, selectedDay)
val dateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.getDefault())
binding.inputExpenseDate.setText(dateFormat.format(expenseDay!!.time))
binding.inputExpenseDate.setText(DateFormat.getWhenStarts())
},
year,
month,
Expand Down Expand Up @@ -118,7 +119,7 @@ class CropCycleAddNewExpensesFragment : Fragment() {
nameOfExpense = binding.inputExpenseName.text.toString(),
amountSpent = binding.inputExpenseAmount.text.toString() ,
whichTask = binding.inputTaskName.text.toString(),
dateOfThisFinancialRecord = expenseDay.toString()
dateOfThisFinancialRecord = binding.inputExpenseDate.text.toString()
)

lifecycleScope.launch {
Expand Down

0 comments on commit 295b9ba

Please sign in to comment.