hcLiesBetweenTimes function

bool hcLiesBetweenTimes(
  1. String sTime,
  2. String eTime
)

Lies Between Times

Implementation

bool hcLiesBetweenTimes(String sTime, String eTime) {
  DateTime now = DateTime.now();
  var format = DateFormat("HH:mm");
  var startTime = format.parse(sTime);
  var endTime = format.parse(eTime);
  startTime =
      DateTime(now.year, now.month, now.day, startTime.hour, startTime.minute);
  endTime =
      DateTime(now.year, now.month, now.day, endTime.hour, endTime.minute);
  if (now.isAfter(startTime) && now.isBefore(endTime)) {
    return true;
  }
  return false;
}