flutter_elinux/lib/common/extension/toFormatedNewsDate.dart

12 lines
360 B
Dart
Raw Normal View History

2024-03-09 14:29:48 +01:00
import 'package:intl/intl.dart';
extension StringExtension on String {
String toFormattedNewsDate() {
final parsedDate = DateTime.parse(this);
// The intl package is used here for more robust formatting options
final DateFormat formatter = DateFormat('dd.MM.yyyy HH:mm', 'de_DE');
return "Stand: ${formatter.format(parsedDate)} Uhr";
}
}