After recently updating my local J-Query library from 1.9.1 to 3.6.0 I have noticed some strange issues. I did not see anything online for this, and most of these functions are standard JavaScript functions I believe, and not J-Query. I am seeing that Date() objects are undefined. Also the following errors with Date and Array objects are happening. If I revert the code to 1.9.1 there is no issue. *Also this is a Node.js project, I dont know if that matters.
TypeError: Date.today is not a function at Object. (main.js:8:126614)
Cannot read properties of undefined (reading 'includes')
TypeError: i.add is not a function
Sample Code
var today = Date.today();
UPDATE: It looks like the code that is not working is coming from this node.js package.
https://github.com/datejs/Datejs
When I change the code to
var today = new Date();
var numberOfDays = today.add(5).days();
Then there is a problem with the add method, see the error listed above.
// Type definitions for DateJS
// Project: http://www.datejs.com/
// Definitions by: David Khristepher Santos <https://github.com/rupertavery>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
CodePudding user response:
How do we flag this for delete, it was early in the process and my description of the issue was not clear. A better description/resolution is listed here: Datejs lib not working after Upgrade to J-Query 3.x
CodePudding user response:
today() is not a method in javascript, maybe you should try this `const today = new Date();
console.log(today);`
