src/Peach/DT/Date.php
protected function adjust(Map $fields)
    {
        // 年と月の不整合を調整します.
        $this->adjustMonth($fields);
        
        $year  = $fields->get(self::$YEAR);
        $month = $fields->get(self::$MONTH);
        $date  = $fields->get(self::$DATE);
        
        // 日が1より小さい場合は、月の繰り下げ調整をします.
        if ($date < 1) {
            while ($date < 1) {
                $month --;
                if ($month === 0) {
                    $month = 12;
                    $year --;
                }
                $fields->put(self::$YEAR,  $year);
                $fields->put(self::$MONTH, $month);
                $date += self::getDateCountOf($year, $month);
            }
            $fields->put(self::$DATE, $date);
            $this->adjust($fields);
            return;
        }
        
        // 日がこの月の日数より大きい場合は、月の繰上げ調整をします.
        $dateCount = self::getDateCountOf($year, $month);
        if ($dateCount < $date) {
            while ($dateCount < $date) {
                $date -= $dateCount;
                $month ++;
                if ($month === 13) {
                    $month = 1;
                    $year ++;
                }
                $fields->put(self::$YEAR,  $year);
                $fields->put(self::$MONTH, $month);
                $dateCount = self::getDateCountOf($year, $month);
            }
            $fields->put(self::$DATE, $date);
            $this->adjust($fields);
            return;
        }
    }
protected function adjust(Map $fields)
    {
        // 年と月の不整合を調整します.
        $this->adjustMonth($fields);
        
        $year  = $fields->get(self::$YEAR);
        $month = $fields->get(self::$MONTH);
        $date  = $fields->get(self::$DATE);
        
        // 日が1より小さい場合は、月の繰り下げ調整をします.
        if ($date < 1) {
            while ($date < 1) {
                $month --;
                if ($month === 0) {
                    $month = 12;
                    $year --;
                }
                $fields->put(self::$YEAR,  $year);
                $fields->put(self::$MONTH, $month);
                $date += self::getDateCountOf($year, $month);
            }
            $fields->put(self::$DATE, $date);
            $this->adjust($fields);
            return;
        }
        
        // 日がこの月の日数より大きい場合は、月の繰上げ調整をします.
        $dateCount = self::getDateCountOf($year, $month);
        if ($dateCount < $date) {
            while ($dateCount < $date) {
                $date -= $dateCount;
                $month ++;
                if ($month === 13) {
                    $month = 1;
                    $year ++;
                }
                $fields->put(self::$YEAR,  $year);
                $fields->put(self::$MONTH, $month);
                $dateCount = self::getDateCountOf($year, $month);
            }
            $fields->put(self::$DATE, $date);
            $this->adjust($fields);
            return;
        }
    }
年月日の不整合を調整します.
@ignore