Skip to content

Commit

Permalink
fix: Fix inconsistent behavior of datetime-picker dialog (#152)
Browse files Browse the repository at this point in the history
---------
Signed-off-by: starry-shivam <[email protected]>
  • Loading branch information
starry-shivam authored Jul 22, 2024
1 parent 2274142 commit d263a46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import com.airbnb.lottie.compose.animateLottieCompositionAsState
import com.airbnb.lottie.compose.rememberLottieComposition
import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
import com.maxkeppeler.sheets.date_time.DateTimeDialog
import com.maxkeppeler.sheets.date_time.models.DateTimeConfig
import com.maxkeppeler.sheets.date_time.models.DateTimeSelection
import com.starry.greenstash.R
import com.starry.greenstash.database.transaction.TransactionType
Expand All @@ -96,6 +97,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.time.LocalDateTime
import java.util.Locale


@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -124,6 +126,7 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont
) { newDateTime ->
selectedDateTime.value = newDateTime
},
config = DateTimeConfig(locale = Locale.US)
)

Scaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState
import com.maxkeppeler.sheets.date_time.DateTimeDialog
import com.maxkeppeler.sheets.date_time.models.DateTimeConfig
import com.maxkeppeler.sheets.date_time.models.DateTimeSelection
import com.starry.greenstash.R
import com.starry.greenstash.database.transaction.Transaction
Expand All @@ -76,6 +77,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.time.Instant
import java.time.LocalDateTime
import java.util.Locale
import java.util.TimeZone


Expand Down Expand Up @@ -109,7 +111,8 @@ fun EditTransactionSheet(
selection = DateTimeSelection.DateTime(
selectedDate = selectedDateTime.value.toLocalDate(),
selectedTime = selectedDateTime.value.toLocalTime(),
) { newDateTime -> selectedDateTime.value = newDateTime }
) { newDateTime -> selectedDateTime.value = newDateTime },
config = DateTimeConfig(locale = Locale.US)
)

if (showEditTransaction.value) {
Expand Down

0 comments on commit d263a46

Please sign in to comment.