class TimeSlotService {
  static DateTime calcTime({
    required DateTime? currentStartTime,
    required DateTime? currentEndTime,
    DateTime? startTime,
    DateTime? endTime,
  }) {

    try {
      if (endTime != null) {
        return endTime.difference(currentStartTime!).inHours < 5 ||
                endTime.isBefore(currentStartTime!)
            ? endTime.subtract(const Duration(hours: 5))
            : currentStartTime;
      } else if (startTime != null) {
        return startTime.difference(currentEndTime!).inHours < 5 ||
                startTime.isAfter(currentEndTime)
            ? startTime.add(const Duration(hours: 5))
            : currentEndTime;
      }
    } catch (e) {
      return DateTime.now().subtract(Duration(minutes: DateTime.now().minute % 10));
    }
    return DateTime.now().subtract(Duration(minutes: DateTime.now().minute % 10));
  }
}
