mirror of
https://github.com/immich-app/immich
synced 2026-08-29 13:15:45 +00:00
18 lines
621 B
Dart
18 lines
621 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
import 'package:immich_mobile/utils/option.dart';
|
|
|
|
part 'time_range.model.freezed.dart';
|
|
|
|
@Freezed(copyWith: false)
|
|
abstract class TimeRange with _$TimeRange {
|
|
const TimeRange._();
|
|
|
|
const factory TimeRange({DateTime? from, DateTime? to}) = _TimeRange;
|
|
|
|
// Patching is custom, which prevents using Freezed `copyWith`
|
|
TimeRange copyWith({Option<DateTime>? from, Option<DateTime>? to}) =>
|
|
TimeRange(from: from.patch(this.from), to: to.patch(this.to));
|
|
|
|
TimeRange clearFrom() => TimeRange(to: to);
|
|
TimeRange clearTo() => TimeRange(from: from);
|
|
}
|