Have added a new Parameter &dobFormat to WebloginPE.
In the snippet:
$dateFormat = isset($dateFormat) ? $dateFormat : '%A %B %d, %Y at %I:%M %p';
$dobFormat = isset($dobFormat) ? $dobFormat : '%m-%d-%Y';//add by Bruno
and
$wlpe->CustomTable($customTable, $customFields, $prefixTable, $tableCheck);
$wlpe->dobFormat=$dobFormat;//add by Bruno
In webloginpe.class.php:
$age = substr($ageDecimal, 0, strpos($ageDecimal, "."));
$modx->setPlaceholder('view.dob', strftime($this->dobFormat, $viewUser['dob']));//dobFormat by Bruno
$modx->setPlaceholder('view.age', $age);
and
// CREDIT : Guillaume for not format an empty date
$value==0?'':$modx->setPlaceholder('user.'.$key, strftime($this->dobFormat, $value));//dobFormat by Bruno
$modx->setPlaceholder('user.age', strftime('%Y', time() - $value));
and have rewritten function MakeDateForDb:
function MakeDateForDb($date)//modified by Bruno for $dobFormat
{
$formatArray= split('[/.-]', $this->dobFormat);
$dateArray= split('[/.-]', $date);
// $date is a string like 01-22-1975.
if (count($dateArray) !== 3)
return $this->FormatMessage($this->LanguageArray[27]);
$daypos = array_search('%d', $formatArray);
$monthpos = array_search('%m', $formatArray);
$yearpos = array_search('%Y', $formatArray);
// $dateArray is somethink like [0]=01, [1]=22, [2]=1975
// make a unix timestamp out of the original date string.
$timestamp = mktime(0, 0, 0, $dateArray[$monthpos], $dateArray[$daypos], $dateArray[$yearpos]);
return $timestamp;
}
Now you can have &dobFormat=`%d.%m.%Y` or `%m-%d-%Y` or `%m/%d/%Y` or what else you want to have.
Bruno