Get a list of death dates.

@param int  $year1
@param int  $year2

@return Builder
972226
public function statsDeathBySexQuery(int $year1 = -1, int $year2 = -1): Builder
    {
        return $this->statsDeathQuery($year1, $year2)
                ->select(['d_month', 'i_sex', DB::raw('COUNT(*) AS total')])
                ->join('individuals', static function (JoinClause $join): void {
                    $join
                        ->on('i_id', '=', 'd_gid')
                        ->on('i_file', '=', 'd_file');
                })
                ->groupBy('i_sex');
    }
103275
public function minusYears(int $years) : LocalDateTime
    {
        if ($years === 0) {
            return $this;
        }

        return new LocalDateTime($this->date->minusYears($years), $this->time);
    }
625398
public function plusYears(int $years) : YearWeek
    {
        if ($years === 0) {
            return $this;
        }

        return $this->withYear($this->year + $years);
    }
506490
public static CalendarPeriod<CalendarYear> between(
        CalendarYear y1,
        CalendarYear y2
    ) {

        return new FixedCalendarPeriod<>(y1, y2, FixedCalendarTimeLine.forYears());

    }
806143
public static long subYears(final Date date1, final Date date2) {

    return Math.abs(getYear(date1) - getYear(date2));
  }
262707
public static function create($year = null, $month = null, $day = null, $hour = null, $min = null, $second = null)
    {
        return Carbon::create($year, $month, $day, $hour, $min, $second);
    }
226537
public static function datediff($date1, $date2) {
		ref\sanitize::date($date1);
		ref\sanitize::date($date2);

		// Same or bad dates.
		if (
			! \is_string($date1) ||
			! \is_string($date2) ||
			($date1 === $date2) ||
			('0000-00-00' === $date1) ||
			('0000-00-00' === $date2)
		) {
			return 0;
		}

		// Prefer DateTime.
		if (\class_exists('DateTime')) {
			$date1 = new \DateTime($date1);
			$date2 = new \DateTime($date2);
			$diff = $date1->diff($date2);

			return \abs($diff->days);
		}

		// Fallback to counting seconds.
		$date1 = \strtotime($date1);
		$date2 = \strtotime($date2);
		return \ceil(\abs($date2 - $date1) / 60 / 60 / 24);
	}
1303639
public static Years<Weekcycle> between(CalendarWeek w1, CalendarWeek w2) {

        int delta = w2.getYear() - w1.getYear();

        if (delta > 0) {
            if (w2.getWeek() < w1.getWeek()) {
                delta--;
            }
        } else if (delta < 0) {
            if (w2.getWeek() > w1.getWeek()) {
                delta++;
            }
        }

        return Years.ofWeekBased(delta);

    }
1150156
public static <D extends Comparable> DateTimeExpression<D> addYears(DateTimeExpression<D> date, int years) {
        return Expressions.dateTimeOperation(date.getType(), Ops.DateTimeOps.ADD_YEARS, date, ConstantImpl.create(years));
    }
274604
public static function firstWeekOfYear($year = null)
    {
        $year = $year ? (int) $year : Date('Y');
        return Carbon::parse($year . '-01-01')->startOfWeek(Carbon::SUNDAY);
    }
446571
public function getHolidaysByYear($year)
    {
        $easter = $this->getEasterDates($year);

        $midSummerDay = $this->getMidSummerDay($year);

        $allSaintsDay = $this->getAllSaintsDay($year);

        return array(
            '01-01' => $this->createData('Nyårsdagen'),
            '01-05' => $this->createData('Trettondagsafton', array('halfday' => true)),
            '01-06' => $this->createData('Trettondedag jul'),
            '04-30' => $this->createData('Valborgsmässoafton', array('halfday' => true)),
            '05-01' => $this->createData('Första maj'),
            '06-06' => $this->createData('Sveriges nationaldag'),
            '12-24' => $this->createData('Julafton'),
            '12-25' => $this->createData('Juldagen'),
            '12-26' => $this->createData('Annandag jul'),
            '12-31' => $this->createData('Nyårsafton'),
            // Variable dates
            $easter['maundyThursday']->format(self::DATE_FORMAT) => $this->createData('Skärtorsdagen', array('halfday' => true)),
            $easter['goodFriday']->format(self::DATE_FORMAT) => $this->createData('Långfredagen'),
            $easter['saturday']->format(self::DATE_FORMAT) => $this->createData('Påskafton'),
            $easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('Påskdagen'),
            $easter['easterMonday']->format(self::DATE_FORMAT) => $this->createData('Annandag påsk'),
            $easter['ascensionDay']->format(self::DATE_FORMAT) => $this->createData('Kristi himmelsfärdsdag'),
            $easter['pentecostSaturday']->format(self::DATE_FORMAT) => $this->createData('Pingstafton'),
            $easter['pentecostSunday']->format(self::DATE_FORMAT) => $this->createData('Pingstdagen'),

            $midSummerDay->format(self::DATE_FORMAT) => $this->createData('Midsommardagen'),
            $midSummerDay->modify('-1 day')->format(self::DATE_FORMAT) => $this->createData('Midsommarafton'),

            $allSaintsDay->format(self::DATE_FORMAT) => $this->createData('Alla helgons dag'),
            $allSaintsDay->modify('-1 day')->format(self::DATE_FORMAT) => $this->createData('Allhelgonaafton', array('halfday' => true))
        );
    }
1006386
public static function dateDiff($Date1, $Date2)
    {
        $DateList1=explode("-", $Date1);
        $DateList2=explode("-", $Date2);
        $d1=mktime(0, 0, 0, $DateList1[1], $DateList1[2], $DateList1[0]);
        $d2=mktime(0, 0, 0, $DateList2[1], $DateList2[2], $DateList2[0]);
        $Days=round(($d1-$d2)/3600/24);
        return $Days;
    }
18963
public static function create($year=null, $month=null, $day=null, $hour=null, $minute=null, $second=null, $tz=null) {
		$year = ($year === null) ? date('Y') : $year;
		$month = ($month === null) ? date('n') : $month;
		$day = ($day === null) ? date('j') : $day;

		if ($hour === null) {
			$hour = date('G');
			$minute = ($minute === null) ? date('i') : $minute;
			$second = ($second === null) ? date('s') : $second;
		}
		else {
			$minute = ($minute === null) ? 0 : $minute;
			$second = ($second === null) ? 0 : $second;
		}

        return static::createFromFormat('Y-n-j G:i:s', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz);
	}
675118
public function chartNoChildrenFamilies(int $year1 = -1, int $year2 = -1): string
    {
        $no_child_fam = $this->noChildrenFamiliesQuery();

        return (new ChartNoChildrenFamilies($this->tree))
            ->chartNoChildrenFamilies($no_child_fam, $year1, $year2);
    }
1085477
public function statsChildrenQuery(int $year1 = -1, int $year2 = -1): array
    {
        $query = DB::table('families')
            ->where('f_file', '=', $this->tree->id())
            ->groupBy('f_numchil')
            ->select(['f_numchil', DB::raw('COUNT(*) AS total')]);

        if ($year1 >= 0 && $year2 >= 0) {
            $query
                ->join('dates', static function (JoinClause $join): void {
                    $join
                        ->on('d_file', '=', 'f_file')
                        ->on('d_gid', '=', 'f_id');
                })
                ->where('d_fact', '=', 'MARR')
                ->whereIn('d_type', ['@#DGREGORIAN@', '@#DJULIAN@'])
                ->whereBetween('d_year', [$year1, $year2]);
        }

        return $query->get()->all();
    }
283193
public function withYear(int $year) : ZonedDateTime
    {
        return ZonedDateTime::of($this->localDateTime->withYear($year), $this->timeZone);
    }
1192356
public function chartNoChildrenFamilies(
        int $no_child_fam,
        int $year1 = -1,
        int $year2 = -1
    ): string {
        $data = [
            [
                I18N::translate('Century'),
                I18N::translate('Total')
            ]
        ];

        $total = 0;

        foreach ($this->queryRecords($year1, $year2) as $record) {
            $total += $record->total;

            $data[] = [
                $this->century_service->centuryName((int) $record->century),
                $record->total
            ];
        }

        if ($total) {
            $data[] = [
                I18N::translateContext('unknown century', 'Unknown'),
                $no_child_fam - $total
            ];
        }

        $chart_title   = I18N::translate('Number of families without children');
        $chart_options = [
            'title' => $chart_title,
            'subtitle' => '',
            'legend' => [
                'position'  => 'none',
            ],
            'vAxis' => [
                'title' => I18N::translate('Total families'),
            ],
            'hAxis' => [
                'title' => I18N::translate('Century'),
            ],
            'colors' => [
                '#84beff'
            ],
        ];

        return view(
            'statistics/other/charts/column',
            [
                'data'          => $data,
                'chart_options' => $chart_options,
                'chart_title'   => $chart_title,
            ]
        );
    }