You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
421 B
Dart

2 years ago
class Utils {
static String getFriendDate(DateTime time) {
var currentTime = DateTime.now();
var timeDelta = currentTime.millisecondsSinceEpoch - time.millisecondsSinceEpoch;
if (timeDelta <= 86400) {
return "刚刚更新";
}
String timeStr = "${time.month}${time.day}";
if (time.year != currentTime.year) {
timeStr = "${time.year}$timeStr";
}
return timeStr;
}
}