Exemplo n.º 1
0
        //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));
        }
Exemplo n.º 2
0
        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));
        }