From 512c245466fad78106a046c1ea6233acdcc3e4de Mon Sep 17 00:00:00 2001
From: Elizabeth Hunt <elizabeth.hunt@simponic.xyz>
Date: Mon, 12 Feb 2024 10:33:17 -0700
Subject: add generatlized

---
 src/scenes/birthday_letters.tsx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/scenes/birthday_letters.tsx')

diff --git a/src/scenes/birthday_letters.tsx b/src/scenes/birthday_letters.tsx
index 2a63360..8fe7990 100644
--- a/src/scenes/birthday_letters.tsx
+++ b/src/scenes/birthday_letters.tsx
@@ -13,13 +13,13 @@ import { FunctionBox } from "../components/function_box";
 import { theme } from "../theme";
 import { PEOPLE, Person, PersonI } from "../components/person";
 
-const daysUntilNextBirthday = (birthDate: Date): number => {
+export const daysUntilNextDate = (date: Date): number => {
   const today = new Date();
 
   const nextBirthday = new Date(
     today.getFullYear(),
-    birthDate.getMonth(),
-    birthDate.getDate(),
+    date.getMonth(),
+    date.getDate(),
   );
   if (today > nextBirthday) nextBirthday.setFullYear(today.getFullYear() + 1);
 
@@ -45,7 +45,7 @@ export const birthdayCardsFor = (people: PersonI[]): CardI[] => {
       `Happy ${age}${ending} birthday, ${person.name}!\n` +
       "I can't believe it's already been a year!";
 
-    const deliverInDays = daysUntilNextBirthday(person.birthday);
+    const deliverInDays = daysUntilNextDate(person.birthday);
     cards.push({ deliverInDays, message });
   }
 
@@ -70,7 +70,7 @@ const birthdayCardsFor = (people: PersonI[]): CardI[] => {
       \`Happy \${age}\${ageEnding} birthday, \${person.name}!\\n\` +
       "I can't believe it's already been a year!";
 
-    const deliverInDays = daysUntilNextBirthday(person.birthday);
+    const deliverInDays = daysUntilNextDate(person.birthday);
     cards.push({ deliverInDays, message });
   }
 
-- 
cgit v1.3

