Skip to content

Commit

Permalink
Merge pull request #2040 from NerLOR/master
Browse files Browse the repository at this point in the history
Fix display name with empty last name when sorting by last name
  • Loading branch information
skjnldsv authored Feb 15, 2021
2 parents 994545b + a481bcf commit 6cbd246
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,17 @@ export default class Contact {
case 'firstName':
// Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
// -> John Stevenson
if (isEmpty(n[0])) {
return n[1]
}
return n.slice(0, 2).reverse().join(' ')

case 'lastName':
// Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
// -> Stevenson, John
if (isEmpty(n[0])) {
return n[1]
}
return n.slice(0, 2).join(', ')
}
}
Expand All @@ -420,6 +426,9 @@ export default class Contact {
if (n && !isEmpty(n)) {
// Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
// -> John Stevenson
if (isEmpty(n[0])) {
return n[1]
}
return n.slice(0, 2).reverse().join(' ')
}
// LAST chance, use the org ir that's the only thing we have
Expand Down

0 comments on commit 6cbd246

Please sign in to comment.