kotlin-material-ui icon indicating copy to clipboard operation
kotlin-material-ui copied to clipboard

How is a `datePicker` wrapped in `LocalizationProvider`?

Open heathwinning opened this issue 4 years ago • 3 comments

I've tried

+LocalizationProvider {
    +datePicker { }
}

with no attrs provided to LocalizationProviderBuilder, but this throws a (probably unrelated) javascript error TypeError: n is not a constructor.

How exactly do I provide DateFnsUtils to the LocalizationProvider?

heathwinning avatar Oct 17 '20 22:10 heathwinning

Here is how I managed to get it working on my side:

LocalizationProvider {
    attrs {
        dateFnsAdapter()
        locale(enUS)
    }

    dateTimePicker {
        ...
    }
}

lucgirardin avatar Nov 18 '20 17:11 lucgirardin

Thanks for publishing, @lucgirardin.

I haven't managed to replicate your success; what versions of everything are you using? The only configuration I can even get to build is

implementation(npm("@material-ui/pickers", "4.0.0-alpha.11"))
implementation("net.subroh0508.kotlinmaterialui:core:0.5.2")
implementation("net.subroh0508.kotlinmaterialui:lab:0.5.2")
implementation("net.subroh0508.kotlinmaterialui:date-io:0.5.2")
implementation("net.subroh0508.kotlinmaterialui:pickers:0.5.2")

heathwinning avatar Nov 18 '20 21:11 heathwinning

That's right, I had to tweak a bit the dependencies and create my own Kotlin wrapper around data-fns. Here is what I am using:

                implementation("net.subroh0508.kotlinmaterialui:pickers:0.5.3") {
                    exclude("subroh0508.net.kotlinmaterialui", "date-io")
                }
                api(npm("@material-ui/pickers", "4.0.0-alpha.12"))

                api(npm("@date-io/core", "^2.6.0"))
                api(npm("@date-io/date-fns", "^2.6.0"))
                api(npm("date-fns", "^2.12.0"))

lucgirardin avatar Nov 20 '20 13:11 lucgirardin