I have an Angular 2 application in which I have few inputs of type date. By default those dates are displayed in the format MM/dd/YYYY
. I need them to be in the format dd.MM.YYYY
. I have fond out that this can be set in the app.module.ts
so that you specify the region that have this format.
The piece of code that should do the job is:
@NgModule({
.
.
.
providers: [AuthGuard, {provide: LOCALE_ID, useValue: 'sl'}],
bootstrap: [AppComponent]
})
This is the HTML part which I want to format
<div class="col-lg-3">
<fieldset class="form-group">
<label>Birth date:</label>
<div class="form-group input-group">
<div class="input-group-append">
<span class="input-group-text">
<i class="fa fa-birthday-cake" aria-hidden="true"></i>
</span>
</div>
<input class="form-control" type="date" [ngModel]="birthDate" />
</div>
</fieldset>
</div>
Do anyone have any ide why this is not working?