TF-46 Compose email for Reply, Forward from EmailView

This commit is contained in:
dab246
2021-08-26 17:12:49 +07:00
committed by Dat H. Pham
parent 5d5c2a3549
commit ee0dc37b7a
10 changed files with 101 additions and 44 deletions
@@ -1,22 +1,10 @@
import 'package:intl/intl.dart';
import 'package:model/model.dart';
import 'package:core/core.dart';
extension PresentationEmailExtension on PresentationEmail {
String getTimeSentEmail(String locale) {
if (sentAt != null) {
if (sentAt!.value.isToday()) {
return DateFormat('h:mm a', locale).format(sentAt!.value);
} else if (sentAt!.value.isYesterday()) {
return DateFormat('EEE', locale).format(sentAt!.value);
} else if (sentAt!.value.isThisYear()) {
return DateFormat('MMMd', locale).format(sentAt!.value);
} else {
return DateFormat('yMMMd', locale).format(sentAt!.value);
}
} else {
return '';
}
String getTimeSentEmail(String newLocale) {
final dateTime = sentAt?.value;
return sentAt.formatDate(pattern: dateTime.toPattern(), locale: newLocale);
}
}