parse static method
Implementation
static String parse({required DateTime date}) {
DateTime now = DateTime.now();
Duration diff = now.difference(date);
if (diff.inDays > 1) {
return 'vor ${diff.inDays} Tagen';
}
if (diff.inDays == 1) {
return 'vor ${diff.inDays} Tag';
}
if (diff.inHours > 1) {
return 'vor ${diff.inHours} Stunden';
}
if (diff.inHours == 1) {
return 'vor ${diff.inHours} Stunde';
}
if (diff.inMinutes > 1) {
return 'vor ${diff.inMinutes} Minuten';
}
return 'gerade eben';
}