Add age to member admin window

This commit is contained in:
2023-04-28 16:03:05 +02:00
parent 4b52af6fe9
commit 735f16731e
3 changed files with 18 additions and 0 deletions

View File

@ -173,5 +173,12 @@ namespace Elwig.Helpers {
public static long DecToDb(decimal value, byte precision) {
return (long)decimal.Round(value * (decimal)Math.Pow(10, precision), 0);
}
public static int GetAge(DateOnly birthday) {
var today = DateTime.Today;
var a = (today.Year * 100 + today.Month) * 100 + today.Day;
var b = (birthday.Year * 100 + birthday.Month) * 100 + birthday.Day;
return (a - b) / 10000;
}
}
}