Angular: 设置日期格式

import { DatePipe } from '@angular/common';

constructor(
	private _datePipe: DatePipe
) {}

formatData(date) {
	date = new Date(date);
	const timeFormat = `${this.padZero(currentValue.getHours())}: ${this.padZero(currentValue.getMinutes()): this.padZero(currentValue.getSeconds())}`;

	date = this._datePipe.transform(date, 'yyyy-MM-dd');
}

你可能感兴趣的:(angular.js)