Fix #1936 don't convert date-only timestamps in extra vars and member birthday column

This commit is contained in:
Kijin Sung 2022-07-03 00:45:35 +09:00
parent 96620b6a8c
commit a5f056284c
3 changed files with 13 additions and 7 deletions

View file

@ -141,9 +141,9 @@ class memberView extends member
$target = $memberInfo->image_mark;
$item->value = '<img src="'.$target->src.'" alt="' . lang('member.image_mark') . '" />';
}
elseif($formInfo->name == 'birthday' && $memberInfo->birthday)
elseif($formInfo->name == 'birthday' && $memberInfo->birthday && preg_match('/^[0-9]{8}/', $item->value))
{
$item->value = zdate($item->value, 'Y-m-d');
$item->value = sprintf('%s-%s-%s', substr($item->value, 0, 4), substr($item->value, 4, 2), substr($item->value, 6, 2));
}
elseif($formInfo->name == 'phone_number' && $memberInfo->phone_number)
{
@ -175,7 +175,11 @@ class memberView extends member
}
elseif($formInfo->type=='date')
{
$item->value = zdate(is_array($orgValue) ? array_first($orgValue) : $orgValue, 'Y-m-d');
$item->value = is_array($orgValue) ? array_first($orgValue) : $orgValue;
if (preg_match('/^[0-9]{8}/', $item->value))
{
$item->value = sprintf('%s-%s-%s', substr($item->value, 0, 4), substr($item->value, 4, 2), substr($item->value, 6, 2));
}
}
else
{