Angular 5 material datepicker not working with moment date adapter and target es2015

712 views Asked by At

After switching from target es5 to es2015 (es6), the datepicker is not working anymore when deploying with --prod flag. I also tried adding --aot flag, but it didn't change anything. The outcome looks as follows:

datepicker blank instead of showing dates

Following Error is thrown:

enter image description here

Using NativeDateAdapter instead of MomentDateAdapter is no solution, as it's necessary that the datepicker is localized correctly.

Only reference i found is:

https://github.com/angular/material2/issues/10347

But as it turns out, there is still no solution.

I would appreciate any help on this!

1

There are 1 answers

0
GC268DM On

I got it working now by conducting a shift from

angular 5.2.3 -> angular 7.1.4

and therefore the angular/material also changed

angular/material 5.2.4 -> angular/material 7.2.0

and together with es2015 it is working great now.

So I can't exactly say what was causing the issue but with newer versions of angular and angular/material it is resolved.