Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

How is a datePicker wrapped in LocalizationProvider? #37

Open
heathwinning opened this issue Oct 17, 2020 · 3 comments
Open

How is a datePicker wrapped in LocalizationProvider? #37

heathwinning opened this issue Oct 17, 2020 · 3 comments

Comments

@heathwinning
Copy link

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?

@lucgirardin
Copy link

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

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

    dateTimePicker {
        ...
    }
}

@heathwinning
Copy link
Author

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")

@lucgirardin
Copy link

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"))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants