Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit 6e1ef5f

Browse files
authored
Improves parsing of phone numbers during user import (#636)
1 parent 9e89e81 commit 6e1ef5f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/platform/src/users/UserImport.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,21 @@ const cleanRow = (row: Record<string, any>): Record<string, any> => {
6262

6363
const cleanCell = (value: any, key: string) => {
6464
if (typeof value === 'string') {
65+
66+
// Parse booleans stored in a string
6567
if (value.toLowerCase() === 'false') return false
6668
if (value.toLowerCase() === 'true') return true
69+
70+
// Parse undefined and null stored in a string
6771
if (value === 'NULL' || value == null || value === 'undefined' || value === '') return undefined
72+
73+
// Parse dates stored in a string
6874
if (key.includes('_at')) return new Date(value)
69-
if (key === 'phone' && !value.includes('+')) return `+${value}`
75+
}
76+
77+
// Handle missformatted phone numbers
78+
if (key === 'phone') {
79+
return `+${String(value).replace(/\D/g, '')}`
7080
}
7181
return value
7282
}

0 commit comments

Comments
 (0)