JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.24k stars 1.11k forks source link

[Web] Uncaught runtime error in Material3 DatePicker (DisplayMode.Input) when enter incorrect date #4856

Closed denzap closed 1 month ago

denzap commented 1 month ago

Describe the bug There is a crash (runtime error DateTimeException) when you use material3.DatePicker in DisplayMode.Input and enter incorrect date like 50/50/2024. Only reproduces in Web, all other targets work correctly.

Affected platforms

Versions

To Reproduce Steps to reproduce the behavior:

  1. Run this code snippet:
    @Composable
    fun BugReproduction() {
       Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
           val state = rememberDatePickerState(initialDisplayMode = DisplayMode.Input)
           DatePicker(state = state)
       }
    }
  2. Enter 50/50/2024 date
  3. See error

Expected behavior There should be no crash but the error tip like "Date does not match expected pattern" like on all other platforms

Screenshots Web crash:

Screenshot 2024-05-23 at 11 16 28

Desktop ok:

Screenshot 2024-05-23 at 11 17 15