Exemple #1
0
        public static bool TryParse(string value, Converter <DateTime?, string> converter, out DateRange date)
        {
            date = null;

            if (!RangeConverter <DateTime> .Split(value, out var start, out var end))
            {
                return(false);
            }

            return(TryParse(start, end, converter, out date));
        }
Exemple #2
0
        public static bool TryParse(string start, string end, Converter <DateTime?, string> converter, out DateRange date)
        {
            date = null;

            var endDate = converter.Get(end);

            if (converter.GetError)
            {
                return(false);
            }

            var startDate = converter.Get(start);

            if (converter.GetError)
            {
                return(false);
            }

            date = new DateRange(startDate, endDate);
            return(true);
        }
Exemple #3
0
 public bool Equals(DateRange other) => other != null && Start == other.Start && End == other.End;