Topic: How to save time value with MDBTimepicker

Mazzilli priority asked 1 year ago


First question: is there a combined date and time component, such as dateAndTimePicker? Second question: using MDBTimepicker I can't find a way to save value when a user select a new time. I've tried the onChange event but it is firing only if I manually enter the time in the input field, not when a user choose a time from the modal. Your component DatePicker has the setValue function, but here it seems unavailable...

Can you help me?


launchbrigade priority answered 10 months ago


I tried using getValue, and instead of getting a value, i got an error...

React does not recognize the `getValue` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `getvalue` instead. If you accidentally passed it from a parent component, remove it from the DOM element.


Krzysztof Wilk staff commented 10 months ago

Hi!

We removed the getValue method from the package and replaced it with the onChange one.


Krzysztof Wilk staff answered 1 year ago


Hi!

According to the first question - there's no such a component for now. According to the second one - we forgot to add in the documentation this feature but after the 1.4.0 release, there is a getValue property you can use :) You can use it i.e. this way:

<MDBTimepicker
   getValue={(pickerValue) => console.log(pickerValue)}
/>

Keep coding!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • User: Priority
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 1.3.0
  • Device: pc
  • Browser: chrome
  • OS: win10 x64
  • Provided sample code: No
  • Provided link: No