2021-02-12 17:53:51 +01:00
|
|
|
import 'package:timeago/timeago.dart' as timeago;
|
|
|
|
|
|
|
|
extension FancyTime on DateTime {
|
2021-02-12 23:44:15 +01:00
|
|
|
/// returns `this` time as a relative, human-readable string. In short format
|
2021-02-12 17:53:51 +01:00
|
|
|
String get fancyShort => timeago.format(this,
|
|
|
|
locale: 'en_short',
|
|
|
|
clock: DateTime.now().subtract(DateTime.now().timeZoneOffset));
|
|
|
|
|
2021-02-12 23:44:15 +01:00
|
|
|
/// returns `this` time as a relative, human-readable string
|
2021-02-12 17:53:51 +01:00
|
|
|
String get fancy => timeago.format(this,
|
|
|
|
clock: DateTime.now().subtract(DateTime.now().timeZoneOffset));
|
|
|
|
}
|