isWithinLast15Minutes method

bool isWithinLast15Minutes(
  1. int epochTime
)

Implementation

bool isWithinLast15Minutes(int epochTime) {
  //Sample from iOS - 1711376486924000
  // Get the current time
  var now = DateTime.now();

  // Calculate the time 15 minutes ago
  var fifteenMinutesAgo =
      now.subtract(const Duration(minutes: Constants.editMessageTimeLimit));

  //
  // Convert the epoch time (in microseconds since epoch) to a DateTime
  var dateTimeFromEpoch = DateTime.fromMicrosecondsSinceEpoch(epochTime);

  // Check if the epoch time is after fifteenMinutesAgo
  return dateTimeFromEpoch.isAfter(fifteenMinutesAgo);
}