Few Days ago I was working on my project and at that moment I came across a problem which how can I use date picker in compose.
So, google it and find and came across solution which fine and you can modify it according to your needs in your project.
package com.geekaid.sdejobs.ui.screensimport android.app.DatePickerDialog
import android.widget.DatePicker
import androidx.compose.material.OutlinedButton
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.ui.platform.LocalContext
import java.util.*@Composable
fun Calender() {var datePicked by remember { mutableStateOf("1") }val context = LocalContext.current
val year: Int
val month: Int
val day: Intval calendar = Calendar.getInstance()
year = calendar.get(Calendar.YEAR)
month = calendar.get(Calendar.MONTH)
day = calendar.get(Calendar.DAY_OF_MONTH)
calendar.time = Date()val datePickerDialog = DatePickerDialog(
context,
{ _: DatePicker, year: Int, month: Int, dayOfMonth: Int ->
datePicked = "$dayOfMonth/$month/$year"
}, year, month, day
)OutlinedButton(onClick = { datePickerDialog.show() }) {
Text(text = "Pick Date")
}
}