【问题标题】:angularJs directive format dateangularJs 指令格式日期
【发布时间】:2014-09-18 17:46:24
【问题描述】:

我有一个无法修改的元素 <input type="date" ng-model="mydate" custom-date />

现在的日期格式为'yyyy-MM-dd HH:mm:ss Z' 我需要将日期格式化为 'yyyy-MM-dd' 。如何编写指令以使用指令“custom-date”格式化应用程序中的所有元素?

我知道 Angular 有日期过滤器 https://docs.angularjs.org/api/ng/filter/date ,但我不想使用它

【问题讨论】:

    标签: javascript angularjs


    【解决方案1】:

    您不能更改输入 type="date" 字段的格式 参考Is there any way to change input type="date" format?

    PS:即使你愿意,你也不能在 ngModel 中使用date 过滤器:)

    【讨论】:

      猜你喜欢
      • 2014-04-20
      • 2015-10-21
      • 2017-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多