Show birth year instead of age in birthday event titles
Title is now "🎂 Name (BirthYear)" instead of "🎂 Name (Age)". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -115,12 +115,14 @@ func OccurrenceDate(c Contact, year int, loc *time.Location) (time.Time, bool) {
|
|||||||
return occ, true
|
return occ, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summary formats c's virtual event title for the given year:
|
// Summary formats c's virtual event title: "🎂 Name", or
|
||||||
// "🎂 Name", or "🎂 Name (Age)" if c's birth year is known.
|
// "🎂 Name (BirthYear)" if c's birth year is known. year is unused for the
|
||||||
|
// title itself (kept for API stability/future use) since the birth year is
|
||||||
|
// shown as-is rather than a computed age.
|
||||||
func Summary(c Contact, year int) string {
|
func Summary(c Contact, year int) string {
|
||||||
s := "🎂 " + c.Name
|
s := "🎂 " + c.Name
|
||||||
if c.Year > 0 {
|
if c.Year > 0 {
|
||||||
s += fmt.Sprintf(" (%d)", year-c.Year)
|
s += fmt.Sprintf(" (%d)", c.Year)
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user