refactoring and checkpoint

This commit is contained in:
DahoudG
2024-09-24 00:32:20 +00:00
parent dc73ba7dcc
commit 6b12cfeb41
159 changed files with 8119 additions and 1535 deletions

View File

@@ -0,0 +1,15 @@
// Fichier utilitaire pour le calcul du temps écoulé
String calculateTimeAgo(DateTime publicationDate) {
final now = DateTime.now();
final difference = now.difference(publicationDate);
if (difference.inDays > 0) {
return '${difference.inDays} jour${difference.inDays > 1 ? 's' : ''}';
} else if (difference.inHours > 0) {
return '${difference.inHours} heure${difference.inHours > 1 ? 's' : ''}';
} else if (difference.inMinutes > 0) {
return '${difference.inMinutes} minute${difference.inMinutes > 1 ? 's' : ''}';
} else {
return 'À l\'instant';
}
}

View File

@@ -2,6 +2,7 @@ import 'package:intl/intl.dart';
class DateFormatter {
static String formatDate(DateTime date) {
return DateFormat('EEEE dd MMMM yyyy', 'fr_FR').format(date);
// Formater la date avec l'heure incluse
return DateFormat('EEEE dd MMMM yyyy, à HH:mm', 'fr_FR').format(date);
}
}