Momentjs Deprecation Warning

when Moment.js is running, Moment Deprecation Warning appears after refreshing the page

replace Date () object with moment object, convert toDate () to Date () object, or continue to have errors

the error message is as follows

Deprecation warning: dates accessor is deprecated. Use date instead.
Arguments: 
Error
    at Moment.dates (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/moment/moment.js:320:98)
    at eval (eval at compile (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/ejs/lib/ejs.js:549:12), <anonymous>:61:39)
    at returnedFn (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/ejs/lib/ejs.js:580:17)
    at tryHandleCache (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/ejs/lib/ejs.js:223:34)
    at View.exports.renderFile [as engine] (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/ejs/lib/ejs.js:437:10)
    at View.render (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/view.js:135:8)
    at tryRender (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/application.js:640:10)
    at Function.render (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/response.js:1008:7)
    at /Users/ephraimguo/Documents/OST_work/booking_Prototype/routes/index.js:248:18
    at Layer.handle [as handle_request] (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/router/layer.js:95:5)
    at /Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/ephraimguo/Documents/OST_work/booking_Prototype/node_modules/express/lib/router/index.js:335:12)

how to deal with this problem.


the answer is obvious: the moment library you are using is old, using an outdated method moment (). Dates , and most recently moment (). Date . (version before 2.16)
solution: upgrade the Moment library to the latest version (currently 2.22.2)
as for how to upgrade, modify the package.json, in the root directory of the project to find the moment, in it and replace it with the latest version number

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2bfde-2a821.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2bfde-2a821.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?