From 00c1c9255165ff31cbab444d9bfc06818765bcd5 Mon Sep 17 00:00:00 2001 From: Marcos Callegario Date: Tue, 15 Feb 2022 12:23:59 -0300 Subject: [PATCH] fix(utilities): check if the normalize function exists --- packages/common/src/services/utilities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/services/utilities.ts b/packages/common/src/services/utilities.ts index 146932f85..a70c22269 100644 --- a/packages/common/src/services/utilities.ts +++ b/packages/common/src/services/utilities.ts @@ -917,7 +917,7 @@ export function parseUtcDate(inputDateString: any, useUtc?: boolean): string { * @returns */ export function removeAccentFromText(text: string, shouldLowerCase = false) { - const normalizedText = text?.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); + const normalizedText = (typeof text.normalize === 'function') ? text.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : text; return shouldLowerCase ? normalizedText.toLowerCase() : normalizedText; }