我有一些代碼處理日期字符串,我想使用日期管道在UI上顯示它。下面是日期Angular 2日期管道處理偏移量時不存在
的採樣值 「2017-02-07T21:23:19.163」
這裏是模板代碼
<div class="input-group" *ngFor="let history of selectedPricingItem.history">
<span class="input-group-addon">
<i class="fa fa-fw fa-calendar-o " aria-hidden="true">
</i>
{{history.createdDate| date:short}}
</span>
<textarea class="form-control" [(ngModel)]="history.generalNotes" rows="2" readonly></textarea>
</div>
這裏是把日期在UI
2017年2月7日,下午5點23
由於某些原因,它在字符串中沒有偏移時添加偏移量。我需要首先將它轉換爲日期對象嗎?
我使用「@角/常見」:「^ 2.2.0」在我的package.json
你使用什麼瀏覽器?在FF和Chrome中它有不同的表現嗎? https://angular.io/docs/ts/latest/api/common/index/DatePipe-pipe.html –