export const getInitials = (name: string) => {
  if (name.length === 0) return '';

  name = name.replace('-', ' ').replace('et', '').replace('&', '');

  const allWords = name.split(' ').filter((w) => w.length > 0);

  let firstLetter = '';
  let secondLetter = '';

  firstLetter = allWords[0][0].toLocaleUpperCase();

  if (allWords.length > 1) {
    // If more than 1 word, we take the first letter of the second word
    secondLetter = allWords[1][0].toLocaleUpperCase();
  } else if (allWords[0].length > 1) {
    // If only 1 word with more than 1 letter, we take the second letter of the first word
    secondLetter = allWords[0][1].toLocaleUpperCase();
  }

  return firstLetter + secondLetter;
};
