mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-12 07:10:44 +08:00
* perf: 优化资源发布时间解析逻辑 * perf: PanSou 源支持前端深度搜索 * feat: 网络公开搜索源支持启用或关闭 * feat: 文件选择窗口支持切换分享链接 * perf: 优化文件选择窗口资源简介展示 * perf: 优化文件选择窗口资源信息样式 * fix: 修复 net.enable=None 时 lower() 报错 * style: 优化资源简介和切换样式 * style: 优化资源搜索配置样式 --------- Co-authored-by: Cp0204 <Cp0204@qq.com>
17 lines
599 B
Python
17 lines
599 B
Python
from datetime import datetime, timezone, timedelta
|
|
|
|
|
|
def iso_to_cst(iso_time_str: str) -> str:
|
|
"""将 ISO 格式的时间字符串转换为 CST(China Standard Time) 时间并格式化为 %Y-%m-%d %H:%M:%S 格式
|
|
|
|
Args:
|
|
iso_time_str (str): ISO 格式时间字符串
|
|
|
|
Returns:
|
|
str: CST(China Standard Time) 时间字符串
|
|
"""
|
|
dt = datetime.fromisoformat(iso_time_str)
|
|
tz = timezone(timedelta(hours=8))
|
|
dt_cst = dt if dt.astimezone(tz) > datetime.now(tz) else dt.astimezone(tz)
|
|
return dt_cst.strftime("%Y-%m-%d %H:%M:%S") if dt_cst.year >= 1970 else ""
|