differenceTime static method

Duration differenceTime(
  1. dynamic tanggalAwal,
  2. dynamic tanggalAkhir
)

Return diff time

Implementation

static Duration differenceTime(dynamic tanggalAwal, dynamic tanggalAkhir) {
  DateTime awal, akhir;

  if (tanggalAwal is DateTime) {
    awal = tanggalAwal;
  } else {
    return const Duration(milliseconds: 0);
  }

  if (tanggalAkhir is DateTime) {
    akhir = tanggalAkhir;
  } else {
    return const Duration(milliseconds: 0);
  }

  Duration duration = akhir.difference(awal);
  return duration;
}