25 lines
528 B
Dart
25 lines
528 B
Dart
import 'package:intl/intl.dart';
|
|
|
|
String formatDate(DateTime date) {
|
|
return DateFormat('yyyy-MM-dd').format(date);
|
|
}
|
|
|
|
String formatTime(DateTime datetime) {
|
|
return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime);
|
|
}
|
|
|
|
bool isToday(DateTime? date) {
|
|
if (date == null) return false;
|
|
|
|
final now = DateTime.now();
|
|
return date.year == now.year &&
|
|
date.month == now.month &&
|
|
date.day == now.day;
|
|
}
|
|
|
|
bool isAfterToday(DateTime? date) {
|
|
if (date == null) return false;
|
|
|
|
return date.isAfter(DateTime.now());
|
|
}
|