From d7aaf8b77509994d36927f2aed45632d6d20f77f Mon Sep 17 00:00:00 2001 From: Suraj B M Date: Fri, 25 Sep 2026 09:06:48 +0530 Subject: [PATCH] fix: move birthday check inside main to get current date --- index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 01e3040..511c2c5 100644 --- a/index.ts +++ b/index.ts @@ -8,15 +8,11 @@ const NTFY_URL = process.env.NTFY_URL const TOPIC = process.env.NTFY_TOPIC const TOKEN = process.env.NTFY_TOKEN -const isBirthday = dayjs().format("MM-DD") === "09-23" - if (!TOKEN || !NTFY_URL || !TOPIC) { console.error("ntfy token, url or topic not set") process.exit(1) } - - async function main() { const [usd, usage, weather] = await Promise.all([ getUSD(), @@ -24,6 +20,8 @@ async function main() { getWeather() ]) + const isBirthday = dayjs().format("MM-DD") === "09-23" + const message = `${isBirthday ? `Happy Birthday, SilicoFlare! You are now ${dayjs().diff(dayjs("2003-09-23"), "years")} years old.` : "Good Morning, SilicoFlare!"} Today is **${dayjs().format("dddd, DD MMMM YYYY")}**.