Уже работающее решение: сравнить их с помощью обычного тернарного оператора (?), но код получается слишком длинным для трех дат, и если позже в будущем будет добавлена четвертая дата, то код будет отстойным. Выглядит некрасиво, но работает.
Код: Выделить всё
(firstdate == null
? ((seconddate == null
? (thirddate == null ? null : thirddate)
: (thirddate == null ? seconddate : ((seconddate < thirddate) ? seconddate : thirddate))) == null
? null
: (seconddate == null
? (thirddate == null ? null : thirddate)
: (thirddate == null ? seconddate : ((seconddate < thirddate) ? seconddate : thirddate))))
: ((seconddate == null
? (thirddate == null ? null : thirddate)
: (thirddate == null ? seconddate : ((seconddate < thirddate) ? seconddate : thirddate))) == null
? firstdate
: ((firstdate < result)
? firstdate
: (seconddate == null
? (thirddate == null ? null : thirddate)
: (thirddate == null ? seconddate : ((seconddate < thirddate) ? seconddate : thirddate))))))
Спасибо.
Мобильная версия