//TODO: CHANGE PROVIDER TO NULLABLE IN C#8 public static Date Parse(string input, IFormatProvider provider, DateTimeStyles styles) { if (input == null) { ExceptionThrower.ThrowArgumentNullException(nameof(input)); } else if (DateTime.TryParse(input, DateTimeFormatInfo.GetInstance(provider), styles, out var dateTime)) { return(new Date(dateTime.Ticks)); } throw new ArgumentOutOfRangeException(nameof(input)); }
public static Date Parse(string input) { if (input == null) { ExceptionThrower.ThrowArgumentNullException(nameof(input)); } else if (DateTime.TryParse(input, out var dateTime)) { return(new Date(dateTime.Ticks)); } throw new ArgumentOutOfRangeException(nameof(input)); }