Get current year for search option
Get current year for search option
ACosta123
Posts: 9Questions: 3Answers: 0
I need to get the current year from current date and use it in a column search, some thing like:
var currDate = new Date();
var year = currDate.getFullYear();
searchCols: [
null,
{ search: year, escapeRegex: false },
null,
null,
null,
null,
]
but I keep on getting an error "Script error. (line 0)"
Help would by appreciated.
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You may need to convert
year
to a string. Try this:{ search: year.toString(), escapeRegex: false },
If this doesn't help then please provide a test case showing the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Spot on! that was it!
Thank you once again Kevin.