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
15 lines
421 B
Dart
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;
|
|
}
|
|
}
|