Save Shortcuts Rev B
This commit is contained in:
@ -13,10 +13,10 @@ public interface IPersonBirthday
|
||||
|
||||
// ...
|
||||
|
||||
string TestStatic_GetDateTime(string personKey) =>
|
||||
GetDateTime(personKey);
|
||||
static string GetDateTime(string personKey) =>
|
||||
personKey.Length < 5 || !personKey.Contains('#') ? personKey : personKey[..2] == "19" ? $"1600{personKey[4..]}" : $"1700{personKey[4..]}";
|
||||
string TestStatic_GetDateTime(string personKeyFormatted) =>
|
||||
GetDateTime(personKeyFormatted);
|
||||
static string GetDateTime(string personKeyFormatted) =>
|
||||
personKeyFormatted.Length < 5 || !personKeyFormatted.Contains('#') ? personKeyFormatted : personKeyFormatted[..2] == "19" ? $"1600{personKeyFormatted[4..]}" : $"1700{personKeyFormatted[4..]}";
|
||||
|
||||
double? TestStatic_GetAge(Models.PersonBirthday birthday) =>
|
||||
GetAge(birthday);
|
||||
@ -68,10 +68,10 @@ public interface IPersonBirthday
|
||||
static TimeSpan? GetTimeSpan(DateTime minimumDateTime, Models.PersonBirthday personBirthday) =>
|
||||
PersonBirthday.GetTimeSpan(minimumDateTime, isWrongYear: false, personBirthday);
|
||||
|
||||
Models.PersonBirthday? TestStatic_GetPersonBirthday(string personBirthdayFormat, string personKey) =>
|
||||
GetPersonBirthday(personBirthdayFormat, personKey);
|
||||
static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKey) =>
|
||||
PersonBirthday.GetPersonBirthday(personBirthdayFormat, personKey);
|
||||
Models.PersonBirthday? TestStatic_GetPersonBirthday(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
GetPersonBirthday(personBirthdayFormat, personKeyFormatted);
|
||||
static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
PersonBirthday.GetPersonBirthday(personBirthdayFormat, personKeyFormatted);
|
||||
|
||||
bool TestStatic_DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) =>
|
||||
DoesBirthDateExits(storage, personBirthday);
|
||||
@ -103,9 +103,9 @@ public interface IPersonBirthday
|
||||
internal static bool DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) =>
|
||||
File.Exists(GetFileFullName(storage, personBirthdayFormat, personBirthday));
|
||||
|
||||
DateTime? TestStatic_GetDateTime(string personBirthdayFormat, string personKey) =>
|
||||
GetDateTime(personBirthdayFormat, personKey);
|
||||
static DateTime? GetDateTime(string personBirthdayFormat, string personKey) =>
|
||||
DateTime.TryParseExact(GetDateTime(personKey), personBirthdayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
||||
DateTime? TestStatic_GetDateTime(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
GetDateTime(personBirthdayFormat, personKeyFormatted);
|
||||
static DateTime? GetDateTime(string personBirthdayFormat, string personKeyFormatted) =>
|
||||
DateTime.TryParseExact(GetDateTime(personKeyFormatted), personBirthdayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
||||
|
||||
}
|
@ -7,14 +7,20 @@ internal abstract class PersonBirthday
|
||||
|
||||
// ...
|
||||
|
||||
internal static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKey)
|
||||
internal static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKeyFormatted)
|
||||
{
|
||||
Models.PersonBirthday? result;
|
||||
DateTime? dateTime = IPersonBirthday.GetDateTime(personBirthdayFormat, personKey);
|
||||
if (dateTime is null)
|
||||
DateTime? dateTime;
|
||||
if (personKeyFormatted.Length != personBirthdayFormat.Length)
|
||||
result = null;
|
||||
else
|
||||
result = new(dateTime.Value);
|
||||
{
|
||||
dateTime = IPersonBirthday.GetDateTime(personBirthdayFormat, personKeyFormatted);
|
||||
if (dateTime is null)
|
||||
result = null;
|
||||
else
|
||||
result = new(dateTime.Value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user