app/Functions/FunctionsImport.php
public static function updateDates($xref, $ged_id, $gedrec): void
    {
        if (strpos($gedrec, '2 DATE ') && preg_match_all("/\n1 (\w+).*(?:\n[2-9].*)*(?:\n2 DATE (.+))(?:\n[2-9].*)*/", $gedrec, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $match) {
                $fact = $match[1];
                if (($fact === 'FACT' || $fact === 'EVEN') && preg_match("/\n2 TYPE ([A-Z]{3,5})/", $match[0], $tmatch)) {
                    $fact = $tmatch[1];
                }
                $date = new Date($match[2]);
                DB::table('dates')->insert([
                    'd_day'        => $date->minimumDate()->day,
                    'd_month'      => $date->minimumDate()->format('%O'),
                    'd_mon'        => $date->minimumDate()->month,
                    'd_year'       => $date->minimumDate()->year,
                    'd_julianday1' => $date->minimumDate()->minimumJulianDay(),
                    'd_julianday2' => $date->minimumDate()->maximumJulianDay(),
                    'd_fact'       => $fact,
                    'd_gid'        => $xref,
                    'd_file'       => $ged_id,
                    'd_type'       => $date->minimumDate()->format('%@'),
                ]);

                if ($date->minimumDate() !== $date->maximumDate()) {
                    DB::table('dates')->insert([
                        'd_day'        => $date->maximumDate()->day,
                        'd_month'      => $date->maximumDate()->format('%O'),
                        'd_mon'        => $date->maximumDate()->month,
                        'd_year'       => $date->maximumDate()->year,
                        'd_julianday1' => $date->maximumDate()->minimumJulianDay(),
                        'd_julianday2' => $date->maximumDate()->maximumJulianDay(),
                        'd_fact'       => $fact,
                        'd_gid'        => $xref,
                        'd_file'       => $ged_id,
                        'd_type'       => $date->minimumDate()->format('%@'),
                    ]);
                }
            }
        }
    }
public static function updateDates($xref, $ged_id, $gedrec): void
    {
        if (strpos($gedrec, '2 DATE ') && preg_match_all("/\n1 (\w+).*(?:\n[2-9].*)*(?:\n2 DATE (.+))(?:\n[2-9].*)*/", $gedrec, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $match) {
                $fact = $match[1];
                if (($fact === 'FACT' || $fact === 'EVEN') && preg_match("/\n2 TYPE ([A-Z]{3,5})/", $match[0], $tmatch)) {
                    $fact = $tmatch[1];
                }
                $date = new Date($match[2]);
                DB::table('dates')->insert([
                    'd_day'        => $date->minimumDate()->day,
                    'd_month'      => $date->minimumDate()->format('%O'),
                    'd_mon'        => $date->minimumDate()->month,
                    'd_year'       => $date->minimumDate()->year,
                    'd_julianday1' => $date->minimumDate()->minimumJulianDay(),
                    'd_julianday2' => $date->minimumDate()->maximumJulianDay(),
                    'd_fact'       => $fact,
                    'd_gid'        => $xref,
                    'd_file'       => $ged_id,
                    'd_type'       => $date->minimumDate()->format('%@'),
                ]);

                if ($date->minimumDate() !== $date->maximumDate()) {
                    DB::table('dates')->insert([
                        'd_day'        => $date->maximumDate()->day,
                        'd_month'      => $date->maximumDate()->format('%O'),
                        'd_mon'        => $date->maximumDate()->month,
                        'd_year'       => $date->maximumDate()->year,
                        'd_julianday1' => $date->maximumDate()->minimumJulianDay(),
                        'd_julianday2' => $date->maximumDate()->maximumJulianDay(),
                        'd_fact'       => $fact,
                        'd_gid'        => $xref,
                        'd_file'       => $ged_id,
                        'd_type'       => $date->minimumDate()->format('%@'),
                    ]);
                }
            }
        }
    }
public static function updateDates ( $ xref , $ ged_id , $ gedrec ) : void { if ( strpos ( $ gedrec , '2 DATE ' ) && preg_match_all ( "/\n1 (\w+).*(?:\n[2-9].*)*(?:\n2 DATE (.+))(?:\n[2-9].*)*/" , $ gedrec , $ matches , PREG_SET_ORDER ) ) { foreach ( $ matches as $ match ) { $ fact = $ match [ 1 ] ; if ( ( $ fact === 'FACT' || $ fact === 'EVEN' ) && preg_match ( "/\n2 TYPE ([A-Z]{3,5})/" , $ match [ 0 ] , $ tmatch ) ) { $ fact = $ tmatch [ 1 ] ; } $ date = new Date ( $ match [ 2 ] ) ; DB :: table ( 'dates' ) -> insert ( [ 'd_day' => $ date -> minimumDate ( ) -> day , 'd_month' => $ date -> minimumDate ( ) -> format ( '%O' ) , 'd_mon' => $ date -> minimumDate ( ) -> month , 'd_year' => $ date -> minimumDate ( ) -> year , 'd_julianday1' => $ date -> minimumDate ( ) -> minimumJulianDay ( ) , 'd_julianday2' => $ date -> minimumDate ( ) -> maximumJulianDay ( ) , 'd_fact' => $ fact , 'd_gid' => $ xref , 'd_file' => $ ged_id , 'd_type' => $ date -> minimumDate ( ) -> format ( '%@' ) , ] ) ; if ( $ date -> minimumDate ( ) !== $ date -> maximumDate ( ) ) { DB :: table ( 'dates' ) -> insert ( [ 'd_day' => $ date -> maximumDate ( ) -> day , 'd_month' => $ date -> maximumDate ( ) -> format ( '%O' ) , 'd_mon' => $ date -> maximumDate ( ) -> month , 'd_year' => $ date -> maximumDate ( ) -> year , 'd_julianday1' => $ date -> maximumDate ( ) -> minimumJulianDay ( ) , 'd_julianday2' => $ date -> maximumDate ( ) -> maximumJulianDay ( ) , 'd_fact' => $ fact , 'd_gid' => $ xref , 'd_file' => $ ged_id , 'd_type' => $ date -> minimumDate ( ) -> format ( '%@' ) , ] ) ; } } } }
Extract all the dates from the given record and insert them into the database.

@param string $xref
@param int    $ged_id
@param string $gedrec

@return void
Extract all the dates from the given record and insert them into the database .