File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/components/mgt-person Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -585,8 +585,7 @@ export class MgtPerson extends MgtTemplatedComponent {
585585 if ( ! initials && person . displayName ) {
586586 const name = person . displayName . split ( / \s + / ) ;
587587 for ( let i = 0 ; i < 2 && i < name . length ; i ++ ) {
588- if ( name [ i ] [ 0 ] && name [ i ] [ 0 ] . match ( / \p{ L} / gu) ) {
589- // check if letter
588+ if ( name [ i ] [ 0 ] && this . isLetter ( name [ i ] [ 0 ] ) ) {
590589 initials += name [ i ] [ 0 ] . toUpperCase ( ) ;
591590 }
592591 }
@@ -595,6 +594,14 @@ export class MgtPerson extends MgtTemplatedComponent {
595594 return initials ;
596595 }
597596
597+ private isLetter ( char : string ) {
598+ try {
599+ return char . match ( new RegExp ( '\\p{L}' , 'u' ) ) ;
600+ } catch ( e ) {
601+ return char . toLowerCase ( ) !== char . toUpperCase ( ) ;
602+ }
603+ }
604+
598605 private handleMouseClick ( e : MouseEvent ) {
599606 if ( this . personCardInteraction === PersonCardInteraction . click ) {
600607 this . showPersonCard ( ) ;
You can’t perform that action at this time.
0 commit comments