question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get value from datepicker

See original GitHub issue

Hi there, I’m successfully created a datepicker using the solution from issue #177, which I modified become like this

class App extends React.Component {
   constructor(){
     super();
    this.handleDateChange = this.handleDateChange.bind(this);
   }
    handleDateChange(e){
        this.setState({roomData: { ...this.state.roomData, date: e.currentTarget.value }})
    }
  componentDidMount () {
    $('.datepicker').pickadate({
      selectMonths: true, // Creates a dropdown to control month
      selectYears: 15 // Creates a dropdown of 15 years to control year
    });
  }

  render () {
        let today = new Date().toISOString().split("T")[0];
        let _this = this;
    return (
      <Input type='date' className='datepicker' data-value={today} onChange={this.handleDateChange}/>
    )
  }
};

Now how can I get the value of the set date from it? The onChange handler doesn’t seem to work

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

0reactions
alextrasterocommented, Mar 24, 2019

Please try react-materialize3.x and reopen if this is still happening, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting value from JQUERY datepicker - Stack Overflow
The #datepickerID part is the ID of the text field containing the selected date, and .val() is a function that grabs the value...
Read more >
How do I get the value of a datepicker? - MDBootstrap
How do I get the value of the datepicker and timepicker? I'm using Jquery and can't find int he documentation where it tells...
Read more >
jQuery UI Datepicker getDate() Method - GeeksforGeeks
jQuery UI Datepicker getDate() method is used to get the date from the date field. Syntax: var a = $( ".selector" ).datepicker( "getDate"...
Read more >
Get the value from a datepicker field - jQuery Forum
So i'm using a datepicker field and i'm trying to send the value to a db through a button field but it is...
Read more >
Datepicker selected value - StackBlitz
can be found in the LICENSE file at http:/ /angular.io/license -->.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found