toHumanReadableTimeCount static method
@param timeMillis the amount of time to convert in milliseconds @param decimals amount of decimals after float point when showing days, weeks, months and years @return
Implementation
static String toHumanReadableTimeCount(int timeMillis) {
late String humanReadable = Duration(milliseconds: timeMillis).toString();
try {
humanReadable = humanReadable.split('.')[0];
} catch (e) {
print(e);
}
return humanReadable;
// int integer;
// double time = timeMillis?.toDouble();
// if(time < TimeUtils.minute) {
// return Intl.NumberFormat("00:00:#00", "en_US").format(time / TimeUtils.second);
// }
//
// if(time < TimeUtils.hour) {
// int mins = (time / TimeUtils.minute).truncate();
// int seconds = (time % TimeUtils.minute).truncate();
// return "00:"
// "${Intl.NumberFormat("#00", "en_US").format(mins)}:"
// "${Intl.NumberFormat("#00", "en_US").format(seconds)}";
// }
// if(time < TimeUtils.day) {
// int hours = (time / TimeUtils.hour).truncate();
// int mins = ((time / TimeUtils.minute) % TimeUtils.minute).truncate();
// int seconds = (time % TimeUtils.minute).truncate();
// return "${Intl.NumberFormat("#00", "en_US").format(hours)}:"
// "${Intl.NumberFormat("#00", "en_US").format(mins)}:"
// "${Intl.NumberFormat("#00", "en_US").format(seconds)}";
// }
//
// if(time < TimeUtils.week) {
// int days = (time / TimeUtils.hour).truncate();
// int mins = ((time / TimeUtils.minute) % TimeUtils.minute).truncate();
// int seconds = (time % TimeUtils.minute).truncate();
// return "${Intl.NumberFormat("#0.00", "en_US").format(hours)}";
// }
// return "$time d";
}