update store model
This commit is contained in:
@@ -74,4 +74,18 @@ class Store extends Model
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* 获取标准时区字符串
|
||||
* 将 UTC 偏移值(如 +8)转换为标准时区格式(如 '+08:00')
|
||||
*
|
||||
* @return string 标准时区字符串,可用于 Carbon 和 DateTime
|
||||
*/
|
||||
public function getTimezoneString(): string
|
||||
{
|
||||
$offset = $this->timezone ?? 0;
|
||||
$sign = $offset >= 0 ? '+' : '-';
|
||||
$absOffset = abs($offset);
|
||||
return sprintf('%s%02d:00', $sign, $absOffset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user