【问题标题】:Moment last day of month parsing issue [closed]每月最后一天解析问题的时刻[关闭]
【发布时间】:2023-04-10 03:05:01
【问题描述】:

为什么这不起作用?我在这里发疯了,试图找到我可能出错的地方,但什么也没想到。仅在 Chrome 中测试。

var startString = "30.01.2017";
var endString = "31.01.2017";

// is OK
var startDate = moment(startString, "DD.MM.YYYY", 'bs',true).clone().toDate();

// breaks down
var endDate = moment(endtString, "DD.MM.YYYY", 'bs',true).clone().toDate();

// console dump
Uncaught ReferenceError: endtString is not defined
at HTMLDocument.<anonymous> (Kreiraj:1062)
at j (jquery.js:3094)
at Object.fireWith [as resolveWith] (jquery.js:3206)
at Function.ready (jquery.js:3412)
at HTMLDocument.I (jquery.js:3428)

我做错了什么?

【问题讨论】:

  • endString 而不是 endTString?
  • 天啊,猜猜这发生在你只有 2 小时的睡眠时......尴尬
  • 感谢大家的积极响应

标签: javascript date momentjs


【解决方案1】:

endtString 是一个错字,应该是endString

【讨论】:

    【解决方案2】:

    你刚刚打错字了。只需将endtstring 更改为endstring

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-10
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多