Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After updated to 1.2.0 DateInput doesn't work #322

Closed
alearcy opened this issue Dec 6, 2016 · 6 comments
Closed

After updated to 1.2.0 DateInput doesn't work #322

alearcy opened this issue Dec 6, 2016 · 6 comments

Comments

@alearcy
Copy link

alearcy commented Dec 6, 2016

Bug report

  • Package version(s): 1.2.0
  • Browser and OS versions: Chrome 54.0.2840.98 (64-bit), Max OS Sierra

Steps to reproduce

with ReduxForm I have a pure function component with DateInput:

const nextYears = new Date(2040, 12, 31);
const renderDate = ({ input, label, type, meta: { touched, error } }) => (
	<div className="input-margin-bottom date-fill">
		<label className="pt-label">{label}</label>
		<DateInput {...input} locale="it" format="DD-MM-YYYY" maxDate={nextYears} position={Position.BOTTOM_RIGHT} className="pt-fill" />
		<div className='text-danger'>{touched ? error : ''}</div>
	</div>
);

Actual behavior

Uncaught TypeError: date.getFullYear is not a function

that refers to:

this.fromDateToMoment = function (date) {
            return moment([
                date.getFullYear(),
                date.getMonth(),
                date.getDate(),
                date.getHours(),
                date.getMinutes(),
                date.getSeconds(),
                date.getMilliseconds(),
            ]);
        };
@giladgray giladgray added this to the 1.3.0 milestone Dec 6, 2016
@mfedderly
Copy link
Contributor

This appears to happen if the value prop is explicitly assigned to null (and not undefined).

@giladgray
Copy link
Contributor

We typically treat those two values as identical, using == null for comparison.

mfedderly added a commit to mfedderly/blueprint that referenced this issue Dec 6, 2016
@alearcy
Copy link
Author

alearcy commented Dec 6, 2016

If I write something like this:

<DateInput value={input.value || undefined} locale="it" format="DD-MM-YYYY" maxDate={nextYears} position={Position.BOTTOM_RIGHT} className="pt-fill" />

no more errors appears when I open form, but date wasn't recognized when submitted

@mfedderly
Copy link
Contributor

@alearcy I suspect that will unblock you in the short term, until the fix from #323 is published.

@alearcy
Copy link
Author

alearcy commented Dec 6, 2016

Thank you so much guys..it's an important work for my customer ;-)

@alearcy
Copy link
Author

alearcy commented Dec 7, 2016

Guys, it is possible to release a 1.2.1 version instead of waiting 1.3 for this small fix?

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

No branches or pull requests

4 participants