h2qutc / angular-material-components

Angular Material Library provide extra components for every project
https://h2qutc.github.io/angular-material-components/
MIT License
331 stars 162 forks source link

Zero before day and month #184

Open paul-lmsg opened 3 years ago

paul-lmsg commented 3 years ago

Hello, I'm trying to display correct french date format with leading zero for day and month when < 10 using moment adapter but it's not working, here is my code :

providers: [
    // DATETIME PICKER
    { provide: NGX_MAT_DATE_FORMATS, useValue: NGX_MAT_MOMENT_FORMATS },
    { provide: NgxMatDateAdapter, useClass: NgxMatMomentAdapter },
  ],
<mat-form-field appearance="fill">
  <mat-label>{{ 'departure_time' | transloco }}</mat-label>
  <input
    matInput
    [ngxMatDatetimePicker]="picker"
    placeholder="{{ 'departure_time' | transloco }}"
    [formControl]="dateFormControl"
  />
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <ngx-mat-datetime-picker #picker> </ngx-mat-datetime-picker>
</mat-form-field>

The left element is what I get and the right is what I want, it's the result of dateFormControl.value.format('L') using moment.js

image

How can I achieve that ?

AntonBobylev commented 2 months ago

Any updates?