Time Picker w/ Time Picker Select - How To Implement #14526
Replies: 1 comment
-
So, through further experimentation, and reading up on Even though it's not listed in the component API, it appears the intended implementation based on how others have implemented
I think I likely have some architectural problems with my component in general. A refactor may be needed, when initially writing the component I had zero intention of using AM/PM and I ended up hacking all of that together and the whole time it has felt like pushing spaghetti around a plate. I think I've answered my question, but if anyone is looking to feel smart I would love to hear how other people accomplish time pickers and building time strings to send back to a database. I'm obviously pretty inexperienced. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm a little confused on how the
<TimePickerSelect>
is intended to be implemented. TheonChange()
function for<TimePicker>
only fires for input changes to the text field. The<TimePickerSelect>
, and<SelectItem>
, don't have onChange() functions in their component API on the storyboard. TimePicker StoryboardWhat was the intended implementation for this, how am I expected to update my time value in memory with "AM/PM"? Or maybe, what is a way to implement it better than my hacky, and now broken, implementation.
Here's the implantation I had that was working, and still is on Mozilla Firefox, but recently stopped working in Chromium browsers:
It's a bit hacky in a few different ways, but specifically the Carbon implementation doesn't list onClick() in the component API, I assume it wasn't intended for use. Like i said, this works and the onClick() fires in Firefox, and was working in Chrome. But recently stopped.
Also, I found that there is an onChange() function for
<TimePickerSelect onChange={}>
that will also fire, but the event doesn't appear to have any information to tell you what item was selected.Beta Was this translation helpful? Give feedback.
All reactions