From 5ad0aa544b680556be5c58ed05d2cea191c6e542 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Wed, 27 Nov 2024 08:10:35 -0800 Subject: [PATCH] chore: replace deprecated String.prototype.substr() with substring() (#5209) --- packages/opentelemetry-core/src/common/time.ts | 2 +- packages/opentelemetry-sdk-trace-base/src/Span.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/opentelemetry-core/src/common/time.ts b/packages/opentelemetry-core/src/common/time.ts index 8d3051b00c1..89f5bfd3f60 100644 --- a/packages/opentelemetry-core/src/common/time.ts +++ b/packages/opentelemetry-core/src/common/time.ts @@ -111,7 +111,7 @@ export function hrTimeDuration( export function hrTimeToTimeStamp(time: api.HrTime): string { const precision = NANOSECOND_DIGITS; const tmp = `${'0'.repeat(precision)}${time[1]}Z`; - const nanoString = tmp.substr(tmp.length - precision - 1); + const nanoString = tmp.substring(tmp.length - precision - 1); const date = new Date(time[0] * 1000).toISOString(); return date.replace('000Z', nanoString); } diff --git a/packages/opentelemetry-sdk-trace-base/src/Span.ts b/packages/opentelemetry-sdk-trace-base/src/Span.ts index b5f3b75b4b5..39a8b303080 100644 --- a/packages/opentelemetry-sdk-trace-base/src/Span.ts +++ b/packages/opentelemetry-sdk-trace-base/src/Span.ts @@ -377,7 +377,7 @@ export class Span implements APISpan, ReadableSpan { if (value.length <= limit) { return value; } - return value.substr(0, limit); + return value.substring(0, limit); } /**