gpt4 book ai didi

javascript - 未捕获的范围错误 : `options.awareOfUnicodeTokens` must be set to `true` to use `YYYY` In date picker

转载 作者:行者123 更新时间:2023-11-30 08:20:58 25 4
gpt4 key购买 nike

我在我的演示 react 项目中使用日期打包器。 https://www.npmjs.com/package/react-datepicker一切正常,但我有一个问题每当我从日期值中删除一个文本时它会给我这个错误

Uncaught RangeError: options.awareOfUnicodeTokens must be set to true to use YYYY token; see: https://git.io/fxCyr at throwProtectedError (nk7475yjwl.codesandbox.io/node_modules/react-datepicker/lib/index.js:2211) at parse (nk7475yjwl.codesandbox.io/node_modules/react-datepicker/lib/index.js:5733) at parseDate (nk7475yjwl.codesandbox.io/node_modules/react-datepicker/lib/index.js:5962) at DatePicker._this.handleChange (nk7475yjwl.codesandbox.io/node_modules/react-datepicker/lib/index.js:8536) at HTMLUnknownElement.callCallback (react-dom.development.js:145) at Object.invokeGuardedCallbackDev (react-dom.development.js:195) at invokeGuardedCallback (react-dom.development.js:248) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:262) at executeDispatch (react-dom.development.js:593) at executeDispatchesInOrder (react-dom.development.js:615) at executeDispatchesAndRelease (react-dom.development.js:713) at executeDispatchesAndReleaseTopLevel (react-dom.development.js:724) at Array.forEach () at forEachAccumulated (react-dom.development.js:692) at runEventsInBatch (react-dom.development.js:855) at runExtractedEventsInBatch (react-dom.development.js:864) at handleTopLevel (react-dom.development.js:4857) at batchedUpdates$1 (react-dom.development.js:17498) at batchedUpdates (react-dom.development.js:2189) at dispatchEvent (react-dom.development.js:4936) at interactiveUpdates$1 (react-dom.development.js:17553) at interactiveUpdates (react-dom.development.js:2208) at dispatchInteractiveEvent (react-dom.development.js:4913)

产生bug的步骤

  1. 运行应用程序。它显示 09-Dec-1998
  2. 尝试从字段或 1998 中删除 8。它显示以上错误

这是我的代码

https://codesandbox.io/s/nk7475yjwl

git 链接 https://github.com/Hacker0x01/react-datepicker

最佳答案

正如它所说 here , YY 和 YYYY 表示本地周编号年份 (44, 01, 00, 17) 经常与表示日历年的 yy 和 yyyy 混淆。

尝试将 dd-MMM-YYYY 替换为 dd-MMM-yyyy

关于javascript - 未捕获的范围错误 : `options.awareOfUnicodeTokens` must be set to `true` to use `YYYY` In date picker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53691245/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com