Re-Write without checking mapped
This commit is contained in:
@ -26,16 +26,53 @@ internal abstract class PersonBirthday
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static TimeSpan? GetTimeSpan(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday)
|
||||
internal static bool IsCounterPersonBirthday(Models.PersonBirthday personBirthday)
|
||||
{
|
||||
bool result;
|
||||
if (personBirthday.Value.Year < 1900)
|
||||
result = true;
|
||||
else
|
||||
result = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static bool IsWrongYearFilterOrCounterPersonBirthday(bool? isWrongYear, Models.PersonBirthday personBirthday)
|
||||
{
|
||||
bool result;
|
||||
if (isWrongYear is null || isWrongYear.Value || IsCounterPersonBirthday(personBirthday))
|
||||
result = true;
|
||||
else
|
||||
result = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static TimeSpan? GetTimeSpan(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday)
|
||||
{
|
||||
TimeSpan? timeSpan;
|
||||
if (isWrongYear is null || isWrongYear.Value || personBirthday.Value.Year < 1900)
|
||||
bool isWrongYearFilterOrCounterPersonBirthday = IsWrongYearFilterOrCounterPersonBirthday(isWrongYear, personBirthday);
|
||||
if (isWrongYearFilterOrCounterPersonBirthday)
|
||||
timeSpan = null;
|
||||
else
|
||||
timeSpan = new(minimumDateTime.Ticks - personBirthday.Value.Ticks);
|
||||
timeSpan = new(minimumDateTimeTicks - personBirthday.Value.Ticks);
|
||||
return timeSpan;
|
||||
}
|
||||
|
||||
internal static TimeSpan? GetTimeSpan(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday)
|
||||
{
|
||||
TimeSpan? timeSpan = GetTimeSpan(minimumDateTime.Ticks, isWrongYear, personBirthday);
|
||||
return timeSpan;
|
||||
}
|
||||
|
||||
internal static (int, TimeSpan) GetAge(long dateTimeTicks, Models.PersonBirthday birthday)
|
||||
{
|
||||
TimeSpan result;
|
||||
int years;
|
||||
if (birthday?.Value is null)
|
||||
throw new NullReferenceException(nameof(birthday.Value));
|
||||
(years, result) = Age.GetAge(dateTimeTicks, birthday.Value);
|
||||
return (years, result);
|
||||
}
|
||||
|
||||
internal static (int, TimeSpan) GetAge(DateTime dateTime, Models.PersonBirthday birthday)
|
||||
{
|
||||
TimeSpan result;
|
||||
|
Reference in New Issue
Block a user