import 'package:get/get.dart';

String convertToAgo(DateTime input) {
  Duration diff = DateTime.now().difference(input);

  if (diff.inDays >= 1) {
    return '${diff.inDays} ' + 'days_ago'.tr;
  } else if (diff.inHours >= 1) {
    return '${diff.inHours} ' + 'hours_ago'.tr;
  } else if (diff.inMinutes >= 1) {
    return '${diff.inMinutes} ' + 'minutes_ago'.tr;
  } else if (diff.inSeconds >= 1) {
    return '${diff.inSeconds} ' + 'seconds_ago'.tr;
  } else {
    return 'just_now'.tr;
  }
}
