Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix inconsistent behavior of datetime-picker dialog #152

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading