Skip to content

Commit 4fc7103

Browse files
committed
fix:修复执行日志时间时区显示
1 parent a83211e commit 4fc7103

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

apps/utils/time_tools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,15 @@ def get_user_timezone(request):
300300
except Exception:
301301
return default_tz
302302

303+
303304
def format_log_time(
304305
log_content,
305306
original_timezone="Asia/Shanghai",
306307
target_timezone="UTC",
307308
output_format="%Y-%m-%d %H:%M:%S%z"
308309
):
310+
if not log_content:
311+
return log_content
309312
pattern = r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})'
310313

311314
orig_tz = pytz.timezone(original_timezone)

0 commit comments

Comments
 (0)