public function convertBirthday($aData)
    {

        // preparing data to process
        $iYear = isset($aData['year']) ? ((int) $aData['year']) : false;
        $iMonth = isset($aData['month']) ? ((int) $aData['month']) : false;
        $iDay = isset($aData['day']) ? ((int) $aData['day']) : false;

        // leaving empty if not set
        if (!$iYear && !$iMonth && !$iDay) {
            return "";
        }

        // year
        if (!$iYear || $iYear < 1000 || $iYear > 9999) {
            $iYear = date('Y');
        }

        // month
        if (!$iMonth || $iMonth < 1 || $iMonth > 12) {
            $iMonth = 1;
        }

        // maximum number of days in month
        $iMaxDays = 31;
        switch ($iMonth) {
            case 2:
                if ($iMaxDays > 28) {
                    $iMaxDays = ($iYear % 4 == 0 && ($iYear % 100 != 0 || $iYear % 400 == 0)) ? 29 : 28;
                }
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                $iMaxDays = min(30, $iMaxDays);
                break;
        }

        // day
        if (!$iDay || $iDay < 1 || $iDay > $iMaxDays) {
            $iDay = 1;
        }

        // whole date
        return sprintf("%04d-%02d-%02d", $iYear, $iMonth, $iDay);
    }