我想以下一个格式显示日期:dd/MM/yyyy
,但它只显示在MM/dd/yyyy
.
这是我的startdateComponent
:
import {Component, EventEmitter, Output, Input} from '@angular/core';
import {DATEPICKER_DIRECTIVES} from 'ng2-bootstrap/components/datepicker';
@Component({
templateUrl:'./app/home/item_component/start_date_component/start_date_component.html',
directives: [DATEPICKER_DIRECTIVES]
})
export class StartDateComponent () {
chosenDate : Date = new Date();
getDate() {
return this.chosenDate;
}
}
模板是:
<div class="col-sm-1 col-sm-offset-1 datePicked ">
<span>
<h4>{{getDate() | date: 'dd/MM/yyyy'}}</h4>
</span>
</div>
这里有什么问题?