mirror of
https://github.com/krawieck/lemmur/
synced 2024-12-12 08:36:18 +01:00
13 lines
488 B
Dart
13 lines
488 B
Dart
|
import 'package:timeago/timeago.dart' as timeago;
|
||
|
|
||
|
extension FancyTime on DateTime {
|
||
|
/// returns [this] time as a relative, human-readable string. In short format
|
||
|
String get fancyShort => timeago.format(this,
|
||
|
locale: 'en_short',
|
||
|
clock: DateTime.now().subtract(DateTime.now().timeZoneOffset));
|
||
|
|
||
|
/// returns [this] time as a relative, human-readable string
|
||
|
String get fancy => timeago.format(this,
|
||
|
clock: DateTime.now().subtract(DateTime.now().timeZoneOffset));
|
||
|
}
|