/// <summary> /// Check if the day found matches the date. /// </summary> /// <param name="parseResult">The parse result.</param> /// <returns></returns> public static bool DayMatchesDate(this BirthDateParseResult parseResult) { if (!parseResult.Success) { throw new InvalidOperationException(); } return(!parseResult.DayOfWeekIndex.HasValue || (parseResult.ToDateTime().DayOfWeek == (DayOfWeek)parseResult.DayOfWeekIndex.Value)); }
/// <summary> /// Convert <see cref="BirthDateParseResult"/> to <see cref="BirthDate"/>. /// </summary> /// <param name="parseResult">The parse result.</param> /// <returns></returns> /// <exception cref="FormatException"></exception> public static BirthDate ToBirthDate(this BirthDateParseResult parseResult) { if (!parseResult.Success) { throw new InvalidOperationException(); } return(new BirthDate( parseResult.ToDateTime(), parseResult.ToBirthDateMaskEnum() )); }