【问题标题】:AngularJs orderBy working on date as stringAngularJs orderBy 将日期作为字符串工作
【发布时间】:2015-04-22 01:05:50
【问题描述】:

AngularJs orderBy 将日期视为字符串。我想将订单作为日期的数值,因为它比较第一个日期,然后是月份和年份。我的json数据如下:

"simplelogin:23" : {
          "chatdiscussion" : "He",
          "nextstep" : "The",
          "sessiondate" : "7 January 2015 +0530",
          "studentemail" : "damchoe.pem1234@gmail.com",
          "studentname" : "Damchoe"
          },

现在我希望具有最新日期的数据首先出现,但它首先过滤日期,然后是月份,然后是年份作为字符串工作
请帮我摆脱困境。

【问题讨论】:

    标签: angularjs date filter sql-order-by firebase


    【解决方案1】:

    您不能过滤像“2015 年 1 月 7 日 +0530”这样的字符串 ...

    您必须:

    • 在您的 JSON 提要中返回更标准/可过滤的日期格式,例如“YYYY-MM-DD HH:ii:ss”
    • 将您的 JSON 日期转换为可过滤的日期(您可以尝试 moment.js

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多