validDateTimeRange static method
check valid date range or not
Implementation
static bool validDateTimeRange({
required String fromDateTime,
required String toDateTime,
String format = Format.fyyyyMMdd,
bool considerSameDateTime = true,
}) {
if (considerSameDateTime) {
return stringToDateTime(
date: fromDateTime,
format: format,
).isBefore(stringToDateTime(date: toDateTime, format: format)) ||
stringToDateTime(date: fromDateTime, format: format).isAtSameMomentAs(
stringToDateTime(date: toDateTime, format: format),
);
} else {
return stringToDateTime(
date: fromDateTime,
format: format,
).isBefore(stringToDateTime(date: toDateTime, format: format));
}
}