Distance bug fix
This commit is contained in:
		| @ -1,35 +1,37 @@ | ||||
| using System.Globalization; | ||||
|  | ||||
| namespace View_by_Distance.Shared.Models.Stateless.Methods; | ||||
|  | ||||
| public interface IPersonBirthday | ||||
| { | ||||
|  | ||||
|     DateTime TestStatic_GetDefaultValue() => | ||||
|         PersonBirthday.GetDefaultValue(); // {{1}}SingletonValue | ||||
|         GetDefaultValue(); | ||||
|  | ||||
|     static DateTime GetDefaultValue() => | ||||
|         PersonBirthday.GetDefaultValue(); // {{1}}SingletonValue | ||||
|         DateTime.MinValue; // {{1}}SingletonValue | ||||
|  | ||||
|     // ... | ||||
|  | ||||
|     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..]}"; | ||||
|  | ||||
|     double? TestStatic_GetAge(Models.PersonBirthday birthday) => | ||||
|         GetAge(birthday); | ||||
|     static double? GetAge(Models.PersonBirthday birthday) => | ||||
|         PersonBirthday.GetAge(birthday); | ||||
|  | ||||
|     DateTime? TestStatic_GetDateTime(string personBirthdayFormat, string personKey) => | ||||
|         PersonBirthday.GetDateTime(personBirthdayFormat, personKey); | ||||
|     static DateTime? GetDateTime(string personBirthdayFormat, string personKey) => | ||||
|         PersonBirthday.GetDateTime(personBirthdayFormat, personKey); | ||||
|  | ||||
|     Models.PersonBirthday TestStatic_GetPersonBirthday(long ticks) => | ||||
|         new(new(ticks)); | ||||
|     static Models.PersonBirthday GetPersonBirthday(long ticks) => | ||||
|         new(new(ticks)); | ||||
|  | ||||
|     string TestStatic_GetFileName(string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.GetFileName(personBirthdayFormat, personBirthday); | ||||
|         GetFileName(personBirthdayFormat, personBirthday); | ||||
|     static string GetFileName(string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.GetFileName(personBirthdayFormat, personBirthday); | ||||
|         $"{personBirthday.Value.ToString(personBirthdayFormat)}.json"; | ||||
|  | ||||
|     (int, TimeSpan) TestStatic_GetAge(DateTime dateTime, Models.PersonBirthday birthday) => | ||||
|         GetAge(dateTime, birthday); | ||||
| @ -41,20 +43,15 @@ public interface IPersonBirthday | ||||
|     static (int, TimeSpan) GetAge(long dateTimeTicks, Models.PersonBirthday birthday) => | ||||
|         PersonBirthday.GetAge(dateTimeTicks, birthday); | ||||
|  | ||||
|     string TestStatic_GetFormatted(string personBirthdayFormat, long personKey) => | ||||
|         GetFormatted(personBirthdayFormat, personKey); | ||||
|     static string GetFormatted(string personBirthdayFormat, long personKey) => | ||||
|         PersonBirthday.GetFormatted(personBirthdayFormat, GetPersonBirthday(personKey)); | ||||
|  | ||||
|     string TestStatic_GetFormatted(string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         GetFormatted(personBirthdayFormat, personBirthday); | ||||
|     static string GetFormatted(string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.GetFormatted(personBirthdayFormat, personBirthday); | ||||
|         personBirthday.Value.ToString(personBirthdayFormat); | ||||
|  | ||||
|     Models.PersonBirthday? TestStatic_GetPersonBirthday(string personBirthdayFormat, string personKey) => | ||||
|         GetPersonBirthday(personBirthdayFormat, personKey); | ||||
|     static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKey) => | ||||
|         PersonBirthday.GetPersonBirthday(personBirthdayFormat, personKey); | ||||
|     string TestStatic_GetFormatted(string personBirthdayFormat, long personKey) => | ||||
|         GetFormatted(personBirthdayFormat, personKey); | ||||
|     static string GetFormatted(string personBirthdayFormat, long personKey) => | ||||
|         GetFormatted(personBirthdayFormat, GetPersonBirthday(personKey)); | ||||
|  | ||||
|     bool TestStatic_IsCounterPersonBirthday(Models.PersonBirthday personBirthday) => | ||||
|         IsCounterPersonBirthday(personBirthday); | ||||
| @ -64,28 +61,28 @@ public interface IPersonBirthday | ||||
|     Models.PersonBirthday TestStatic_GetNextBirthDate(Properties.IStorage storage) => | ||||
|         GetNextBirthDate(storage); | ||||
|     static Models.PersonBirthday GetNextBirthDate(Properties.IStorage storage) => | ||||
|         PersonBirthday.GetNextBirthDate(storage); | ||||
|         throw new Exception(storage.ToString()); // Person.GetNextBirthDate(storage); | ||||
|  | ||||
|     TimeSpan? TestStatic_Get(DateTime minimumDateTime, Models.PersonBirthday personBirthday) => | ||||
|         GetTimeSpan(minimumDateTime, isWrongYear: false, personBirthday); | ||||
|     static TimeSpan? GetTimeSpan(DateTime minimumDateTime, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.GetTimeSpan(minimumDateTime, isWrongYear: false, personBirthday); | ||||
|  | ||||
|     TimeSpan? TestStatic_Get(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) => | ||||
|         GetTimeSpan(minimumDateTimeTicks, isWrongYear, personBirthday); | ||||
|     static TimeSpan? GetTimeSpan(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.GetTimeSpan(minimumDateTimeTicks, isWrongYear, personBirthday); | ||||
|  | ||||
|     string TestStatic_GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         GetFileFullName(storage, personBirthdayFormat, personBirthday); | ||||
|     static string GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.GetFileFullName(storage, personBirthdayFormat, personBirthday); | ||||
|     Models.PersonBirthday? TestStatic_GetPersonBirthday(string personBirthdayFormat, string personKey) => | ||||
|         GetPersonBirthday(personBirthdayFormat, personKey); | ||||
|     static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKey) => | ||||
|         PersonBirthday.GetPersonBirthday(personBirthdayFormat, personKey); | ||||
|  | ||||
|     bool TestStatic_DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) => | ||||
|         DoesBirthDateExits(storage, personBirthday); | ||||
|     static bool DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) => | ||||
|         DoesBirthDateExits(storage, personBirthday); | ||||
|  | ||||
|     TimeSpan? TestStatic_Get(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) => | ||||
|         GetTimeSpan(minimumDateTimeTicks, isWrongYear, personBirthday); | ||||
|     static TimeSpan? GetTimeSpan(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.GetTimeSpan(minimumDateTimeTicks, isWrongYear, personBirthday); | ||||
|  | ||||
|     TimeSpan? TestStatic_Get(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday) => | ||||
|         GetTimeSpan(minimumDateTime, isWrongYear, personBirthday); | ||||
|     static TimeSpan? GetTimeSpan(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday) => | ||||
| @ -96,4 +93,19 @@ public interface IPersonBirthday | ||||
|     static bool IsWrongYearFilterOrCounterPersonBirthday(bool? isWrongYear, Models.PersonBirthday personBirthday) => | ||||
|         PersonBirthday.IsWrongYearFilterOrCounterPersonBirthday(isWrongYear, personBirthday); | ||||
|  | ||||
|     string TestStatic_GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         GetFileFullName(storage, personBirthdayFormat, personBirthday); | ||||
|     static string GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         Path.Combine(storage.PeopleRootDirectory, "{}", GetFileName(personBirthdayFormat, personBirthday)); | ||||
|  | ||||
|     bool TestStatic_DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => | ||||
|         DoesBirthDateExits(storage, personBirthdayFormat, personBirthday); | ||||
|     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; | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user