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.

Accept value as string

See original GitHub issue

I keep getting these three errors:

proxyConsole.js:56 Warning: Failed prop type: Invalid prop `value` supplied to `MonthView`.
    in MonthView
...
./node_modules/react-date-picker/node_modules/react/cjs/react.development.js.Component.setState	@	react.development.js:237
DatePicker._this.closeCalendar	@	DatePicker.js:70
DatePicker._this.onClick	@	DatePicker.js:65
proxyConsole.js:56 Warning: Failed prop type: Invalid prop `value` supplied to `Days`.
    in Days
...
./node_modules/react-date-picker/node_modules/react/cjs/react.development.js.Component.setState @ react.development.js:237
DatePicker._this.closeCalendar @ DatePicker.js:70
DatePicker._this.onClick @ DatePicker.js:65
dates.js:34 Uncaught TypeError: date.getMonth is not a function
  at getMonthIndex (dates.js:34)
    at getBeginOfDay (dates.js:258)
    at getDayRange (dates.js:276)
    at getRange (dates.js:452)
    at getTileClasses (utils.js:93)
    at Days.render (Days.js:72)
    ...

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
SreekanthReddyKambamcommented, Jan 17, 2019

I have faced the same issue saying date.getMonth is not a function in the console when I click the calendar icon to change the date

        <DatePicker value={this.state.RevisionDate} required={true} onChange=this.handleRevisionDateChanged} />


          private handleRevisionDateChanged(value: Date): void {
                 return this.setState({
                RevisionDate: value
            });
        }

the state variable Revisiondate is a property of Date type, any help?

1reaction
wojtekmajcommented, Mar 7, 2018

@dfalling, thanks for this. react-date-picker does not support value as a string, as in documentation. You need to wrap the date in new Date().

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can a string accept an integer? - java - Stack Overflow
Anything that is given in double quotes is String and + is for concatenating string with an any value(int value). So the integer...
Read more >
Check user Input is a Number or String in Python - PYnative
Use string isdigit() method to check user input is number or string. Note: The isdigit() function will work only for positive integer numbers. ......
Read more >
Program to check if input is an integer or a string
Write a function to check whether a given input is an integer or a string. Definition of an integer : Every element should...
Read more >
Handling text — strings in JavaScript - Learn web development
Just like we did with numbers, we are declaring a variable, initializing it with a string value, and then returning the value.
Read more >
15: 9.4. String Functions and Operators - PostgreSQL
This section describes functions and operators for examining and manipulating string values. Strings in this context include values of the types character ...
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