ERROR 错误:InvalidPipeArgument:“无法转换“无效日期"管道'DatePipe'的日期' [英] ERROR Error: InvalidPipeArgument: 'Unable to convert "Invalid Date" into a date' for pipe 'DatePipe'
本文介绍了ERROR 错误:InvalidPipeArgument:“无法转换“无效日期"管道'DatePipe'的日期'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我也试图用时间格式化日期,但这会引发错误.我发送请求的方式是:
I am trying to format a date with time too but this throw an error. The way as I am sending the request is:
created = this.datePipe.transform(dateCreated, 'yyyy-MM-ddTHH:mm');
我需要时间,因为我使用的服务需要这个参数和时间来精确过滤数据.
I need the time because I am consume a service which needs this parameter with time to filter exactly the data.
下一张图片是错误:
推荐答案
只接受日期格式
Year:
YYYY (eg 1997)
Year and month:
YYYY-MM (eg 1997-07)
Complete date:
YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of a
second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
这篇关于ERROR 错误:InvalidPipeArgument:“无法转换“无效日期"管道'DatePipe'的日期'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文