【问题标题】:How to display Date (angular) internet explorer browser如何显示日期(角度)Internet Explorer 浏览器
【发布时间】:2018-07-26 14:17:49
【问题描述】:

角度问题:

我无法使用 Internet Explorer 浏览器显示日期。

“无效的管道参数”

角度#internet explorer

【问题讨论】:

  • 请阅读 stackoverflow.com/help/how-to-ask 并分享相关代码部分并在您的问题中填写错误消息(作为文本,而不是作为图像)。
  • 当我在 Internet Explorer 浏览器中运行我的项目时,它显示“无效的管道参数”并且不显示日期
  • 你能告诉我们你是如何使用你的管道的吗?
  • {{notification.created_at|日期:'MM-dd-yyyy h:mm:ss a'}}

标签: angular typescript date internet-explorer pipe


【解决方案1】:

试试这个:

{{notification.created_at | date:'MM/d/y h:mm:ss a'}}

中间日期也非常接近您正在寻找的:

{{notification.created_at | date:'medium'}}    

如需进一步参考,请查看:https://angular.io/api/common/DatePipe

【讨论】:

  • 我使用错误的任何格式都是相同的('无效的管道参数')
  • 如果你console.log(notification.created_at); 它是什么样子的?
  • DatePipe 需要一个日期对象而不是字符串。确保您的日期格式正确。有关 javascript 日期格式的更多信息,请查看此处:w3schools.com/js/js_date_formats.asp
猜你喜欢
  • 2014-04-12
  • 2010-11-05
  • 2015-08-17
  • 2020-10-02
  • 1970-01-01
  • 1970-01-01
  • 2023-03-09
  • 2020-04-05
  • 1970-01-01
相关资源
最近更新 更多