-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[datepicker, es2015] Cannot read property 'focus' of null #10347
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
Comments
es2015 currently works in AOT mode only, see #8284 (comment) |
@mmalerba, Datepicker don't show dates if I build with |
Did you try |
Yes, I tried. But this did not give positive results. |
Ok, I am able to reproduce as well, maybe its not related to #8284, will reopen. |
Tried it out with the various flags that ng serve --aot=true --environment=prod --output-hashing=all --sourcemaps=false \
--extract-css=true --named-chunks=false --build-optimizer=true Everything seems to work fine, but it breaks with I also tried swapping out |
After some further investigation, the issue appears to be in Moment.js here: https://github.com/moment/moment/blob/23104ffecdcf7a084babe20997d96a410540ff98/src/lib/units/month.js#L19-L26 The following function: export function daysInMonth(year, month) {
if (isNaN(year) || isNaN(month)) {
return NaN;
}
var modMonth = mod(month, 12);
year += (month - modMonth) / 12;
return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
} is being compiled to: function je(e, t) {
if (isNaN(e) || isNaN(t))
return NaN;
return e += (t - NaN) / 12,
NaN
} |
@mmalerba, thank you very much for your investigation. |
@mantyz It seems like probably an Uglify issue, that transformation doesn't seem valid to me. But it may be worth reporting to Moment.js as well so they can work around it until it's fixed. |
@mantyz thanks, rollback momentjs version to 2.18.0 solved the problem in fastest way |
This should have been fixed as I am unable to replicate this any longer with the latest CLI. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Bug
Datepicker don't work if builded(--prod) with TS target = es2015
What is the expected behavior?
Datepicker must show dates.
What is the current behavior?
Datepicker don't show dates.

What are the steps to reproduce?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
OS: Debian 8
Browsers: Chrome 65, Firefox 58
Is there anything else we should know?
Worked if builded with target=es5.
And worked if ng serve --aot with target=es2015.
The text was updated successfully, but these errors were encountered: