Replace deprecated String.prototype.substr()

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
Tobias Speicher
2022-03-24 15:47:29 +01:00
parent bba6e48257
commit daf6442c13
4 changed files with 6 additions and 6 deletions

View File

@@ -92,7 +92,7 @@ export default {
const filterOutQuotes = (q) => {
if (q[0] === '"' && q[q.length - 1] === '"') {
return q.substr(1, q.length - 2)
return q.slice(1, -1)
}
return q
}
@@ -153,7 +153,7 @@ export default {
const comparator = query[0] + (query[1] === '=' ? '=' : '')
const isValidComparator = ['<', '<=', '>', '>='].indexOf(comparator) !== -1
const parsedCardDate = moment(card.duedate)
const parsedDate = moment(query.substr(isValidComparator ? comparator.length : 0))
const parsedDate = moment(query.slice(isValidComparator ? comparator.length : 0))
switch (comparator) {
case '<':
hasMatch = hasMatch && parsedCardDate.isBefore(parsedDate)