Replace deprecated String.prototype.substr() (#8988)

String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) 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:
CommanderRoot
2022-06-06 16:16:38 +02:00
committed by GitHub
parent c6a802b177
commit 76738daff8
4 changed files with 4 additions and 4 deletions

View File

@@ -54,7 +54,7 @@ export function rendererPhotos(context) {
// validate the date
var date = val && new Date(val);
if (date && !isNaN(date)) {
val = date.toISOString().substr(0, 10);
val = date.toISOString().slice(0, 10);
} else {
val = null;
}

View File

@@ -434,7 +434,7 @@ export function uiFieldCombo(field, context) {
var v = tags[k];
if (!v || (typeof v === 'string' && v.toLowerCase() === 'no')) continue;
var suffix = field.key ? k.substr(field.key.length) : k;
var suffix = field.key ? k.slice(field.key.length) : k;
_multiData.push({
key: k,
value: displayValue(suffix),

View File

@@ -71,7 +71,7 @@ export function uiSuccess(context) {
}
const parsed = new Date(raw);
return new Date(parsed.toUTCString().substr(0, 25)); // convert to local timezone
return new Date(parsed.toUTCString().slice(0, 25)); // convert to local timezone
}

View File

@@ -403,7 +403,7 @@ export function utilPrefixDOMProperty(property) {
if (property in s) return property;
property = property.substr(0, 1).toUpperCase() + property.substr(1);
property = property.slice(0, 1).toUpperCase() + property.slice(1);
while (++i < n) {
if (prefixes[i] + property in s) {