From 22cebd7dac8e1ec0e9f1a29cf368daed2530d865 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 16 Dec 2023 23:02:43 -0800
Subject: fix(birthdays): aniSearch caps fix

---
 src/lib/Tools/CharacterBirthdays.svelte | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

(limited to 'src/lib/Tools/CharacterBirthdays.svelte')

diff --git a/src/lib/Tools/CharacterBirthdays.svelte b/src/lib/Tools/CharacterBirthdays.svelte
index 3a8abaed..02fdad22 100644
--- a/src/lib/Tools/CharacterBirthdays.svelte
+++ b/src/lib/Tools/CharacterBirthdays.svelte
@@ -41,6 +41,18 @@
 
 	const normalizeName = (name: string): string => name.toLowerCase().split(' ').sort().join(' ');
 
+	const fixName = (name: string): string => {
+		const split = name.split(' ');
+		const last = split[split.length - 1];
+
+		if (last === last.toUpperCase()) {
+			split[split.length - 1] = last[0] + last.slice(1).toLowerCase();
+			return split.join(' ');
+		}
+
+		return name;
+	};
+
 	const combineBirthdaySources = (
 		acdb: ACDBBirthday[],
 		aniSearch: aniSearchBirthday[]
@@ -52,7 +64,7 @@
 			normalized_name: normalizeName(entry.name)
 		})))
 			nameMap.set(entry.normalized_name, {
-				name: entry.name,
+				name: fixName(entry.name),
 				image: entry.image
 			});
 
-- 
cgit v1.2.3

