Output an ical file

Almost there—but we’re only adding birthdays to the current year.
This commit is contained in:
Trevor Vallender 2024-03-03 14:52:12 +00:00
parent 36d1e481e9
commit db982373c7
1 changed files with 3 additions and 7 deletions

View File

@ -6,8 +6,8 @@ require "yaml"
class Birthdaze < Thor
desc "generate", "Generate calendars"
def generate
puts "Generate calendars"
puts calendar.inspect
puts "Writing ical file to #{config['ical_output']}"
File.open(config["ical_output"], 'w') { |file| file.write(calendar.to_ical) }
end
desc "list", "List birthdays"
@ -90,11 +90,7 @@ class Birthdaze < Thor
end
def summary(name, birthday)
return "#{name}s birthday" if birthday.start_with?("-") || birthday.start_with?("1604")
birth_year = birthday[0..3].to_i
age = Date.today.year - birth_year + 1
"🎂 #{name}s #{age} birthday"
return "🎂 #{name}s birthday"
end
def set_reminders