mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 17:26:18 +01:00
21 lines
500 B
Dart
21 lines
500 B
Dart
|
import 'package:nc_photos/entity/file.dart';
|
||
|
|
||
|
class PhotoListDateGroupHelper {
|
||
|
PhotoListDateGroupHelper({
|
||
|
required this.isMonthOnly,
|
||
|
});
|
||
|
|
||
|
DateTime? onFile(File file) {
|
||
|
final newDate = file.bestDateTime.toLocal();
|
||
|
if (newDate.year != _currentDate?.year ||
|
||
|
newDate.month != _currentDate?.month ||
|
||
|
(!isMonthOnly && newDate.day != _currentDate?.day)) {
|
||
|
_currentDate = newDate;
|
||
|
return newDate;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
final bool isMonthOnly;
|
||
|
DateTime? _currentDate;
|
||
|
}
|