isTimeSlotValide method

bool isTimeSlotValide()

Implementation

bool isTimeSlotValide() {
  try {
    // Check if dates exist
    String? startDateStr = _singleton._troubleshooting?.startDate;
    String? endDateStr = _singleton._troubleshooting?.endDate;

    if (startDateStr == null ||
        startDateStr.isEmpty ||
        endDateStr == null ||
        endDateStr.isEmpty) {
      return false;
    }

    // Get the dates
    DateTime startDate = DateTime.parse(startDateStr);
    DateTime endDate = DateTime.parse(endDateStr);

    // Get the actual date
    DateTime actualDate = DateTime.now();
    return actualDate.isAfter(startDate) && actualDate.isBefore(endDate);
  } catch (e) {
    // No dates for Troubleshooting
    return false;
  }
}