Hello,
i want that the Age is shown instead of the year in the Birthday calendar.
This solution does not work on NC 12: [Help] Birthday calendar entry - showing also the age on the title
Anyone can help?
Hello,
i want that the Age is shown instead of the year in the Birthday calendar.
This solution does not work on NC 12: [Help] Birthday calendar entry - showing also the age on the title
Anyone can help?
Hello,
i found a solution in β/apps/dav/lib/CalDAV/BirthdayService.phpβ
replace
$unknownYear = false;
if (!$dateParts['year']) {
$birthday = '1900-' . $dateParts['month'] . '-' . $dateParts['date'];
$unknownYear = true;
}
try {
$date = new \DateTime($birthday);
} catch (Exception $e) {
return null;
}
if ($unknownYear) {
$summary = $doc->FN->getValue() . ' ' . $summarySymbol;
} else {
$year = (int)$date->format('Y');
$summary = $doc->FN->getValue() . " ($summarySymbol$year)";
}
with
$actyear = date('Y', time());
$age = (int)$actyear - (int)substr((string)$birthday, 0, 4);
$unknownYear = false;
if (!$dateParts['year']) {
$birthday = '1900-' . $dateParts['month'] . '-' . $dateParts['date'];
$unknownYear = true;
}
try {
$date = new \DateTime($birthday);
} catch (Exception $e) {
return null;
}
if ($unknownYear) {
$summary = $doc->FN->getValue() . ' ' . $summarySymbol;
} else {
$year = (int)$date->format('Y');
$summary = $doc->FN->getValue() . " ($summarySymbol$year) [$age] ";
}
very well done, i think!
the problem might be that with every update you need to rechange the code in said file again.
so would you pls file an issue in gh (https://github.com/nextcloud/calendar) and present this codechange as a solution or make an app by yourself that would extend the calendar-app?
this way your changes would survive every updateβ¦
Hi,
I know this is an old topic but at least I searched for it instead of posting a new one
The mentioned Pull Request to improve the calendar entrys has been closed unsuccessful, i could not find newer topics that adress this issue.
Donβt get me wrong the birthday calendar is great, but it would be even better if you could see how old a person got with one glance at the entry instead of starting to calculate in the head.
If i understand correctly from the Pull Request the difficulty lies in the calendar entry being static while the age changes every year.
I see two ways to work around that:
The obvious choice for me would be option two since it is the only choice that can be solved by NC alone. It would mean more calendar entrys though which influences processing speed and filesize of the calendar (resulting in more data strain for mobile users if they sync the calendar regularly). For me that would be a tradeoff i am willing to take, but I can only speak for myself.
Does this make sense or am I missing something?
greetings
STonE