0
我試圖從這種格式的日期轉換 '2017-12-13T03:00:00Z [UTC]',格式爲'yyyy/MM/dd'。 我得到這個代碼:Angular4無效的管道參數
this.datepipe.transform(d.hour, 'yyyy-MM-dd HH:mm a z')
this.datepipe.transform(d.initDate, 'yyyy/MM/dd')
this.datepipe.transform(d.endDate, 'yyyy/MM/dd')
而且在瀏覽器中我得到這個錯誤:
ERROR Error: InvalidPipeArgument: '2017-12-13T03:00:00Z[UTC]' for pipe 'DatePipe'
at invalidPipeArgumentError (common.es5.js:2610)
at DatePipe.webpackJsonp.../../../common/@angular/common.es5.js.DatePipe.transform (common.es5.js:3506)
at discipinscripcion.component.ts:31
at Array.forEach (<anonymous>)
at DiscipinscripcionComponent.webpackJsonp.../../../../../src/app/components/discipinscripcion/discipinscripcion.component.ts.DiscipinscripcionComponent.inscribir (discipinscripcion.component.ts:29)
at Object.eval [as handleEvent] (DiscipinscripcionComponent.html:21)
at handleEvent (core.es5.js:11998)
at callWithDebugContext (core.es5.js:13467)
at Object.debugHandleEvent [as handleEvent] (core.es5.js:13055)
at dispatchEvent (core.es5.js:8614)
任何提示的那種日期格式轉換爲YYYY/MM/DD? 非常感謝!