copy method

  1. @override
Jalali copy({
  1. int? year,
  2. int? month,
  3. int? day,
  4. int? hour,
  5. int? minute,
  6. int? second,
  7. int? millisecond,
})
override

Copy this date object with some fields changed

Original date object remains unchanged

You can leave out items for not changing them

This method is NOT safe

This method does change all fields at once, Not individually in a order

Throws DateException on problems

Note: For ordering use with*() methods

Implementation

@override
Jalali copy({
  int? year,
  int? month,
  int? day,
  int? hour,
  int? minute,
  int? second,
  int? millisecond,
}) {
  if (year == null &&
      month == null &&
      day == null &&
      hour == null &&
      minute == null &&
      second == null &&
      millisecond == null) {
    return this;
  } else {
    return Jalali(
      year ?? this.year,
      month ?? this.month,
      day ?? this.day,
      hour ?? this.hour,
      minute ?? this.minute,
      second ?? this.second,
      millisecond ?? this.millisecond,
    );
  }
}