简体   繁体   English

Moment.js折旧-如何查找引起警告的代码行?

[英]Moment.js depreciation - how to find line of code causing waring?

I am trying to debug an application I did not write myself. 我正在尝试调试自己未编写的应用程序。 The last issue is the moment.js depreciation error: Deprecation warning: moment construction falls back to js Date. 最后一个问题是moment.js折旧错误:弃用警告:此刻构造回落到js Date。 This is discouraged and will be removed in upcoming major release. 不建议这样做,并将在即将发布的主要版本中将其删除。 Please refer to https://github.com/moment/moment/issues/1407 for more info. 请参阅https://github.com/moment/moment/issues/1407了解更多信息。

I understand how to format the date correctly to resolove the issue, but its a fairly complicated calendar booking system. 我知道如何正确设置日期格式以解决问题,但是它的日历预订系统相当复杂。 moment.js is heavily used throughout. moment.js在整个过程中都被大量使用。

Is there a better way to use debugging tools or console log to determine what file / line is throwing the warning message. 有没有更好的方法来使用调试工具或控制台日志来确定哪个文件/行引发了警告消息。 Rather than read throught all the code line by line? 而不是逐行阅读所有代码?

thank you 谢谢

I successfully placed "debugger" inside the calling warning function of moment to trigger chrome debug tool and pause the application when an warning occurred. 我成功地将“ debugger”放置在当前调用警告功能中,以触发chrome调试工具并在发生警告时暂停应用程序。 Then used sources > Stack, inside the debugger, to point out where the warnings are getting called from. 然后,在调试器内部使用source> Stack来指出从何处调用警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM