handle Date and POSIXct in min and max