Skip to content

Commit

Permalink
pref(str): TimeParse The string parses the date using the local time …
Browse files Browse the repository at this point in the history
…instead of the UTC time to avoid errors caused by time zones
  • Loading branch information
conero committed Dec 16, 2024
1 parent abcfa19 commit 43c1b75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ChangeLog_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
- **cli**
- pref: 系统自定 help 命令,为空时对其进行介绍而非空

- **secure/aesutil**
- feat: 新增 Aes CBC、CFB、GCM、CTR,OFB模式加解密函数
- feat: 新增 Pkcs#7、Zero Padding,用于填充或还原变量
- **str**
- pref: TimeParse 字符串解析日期使用本地时间代替UTC时间,以避免因时区引起的误差




Expand Down
2 changes: 1 addition & 1 deletion str/time_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TimeParse(tmStr string) (time.Time, error) {
if err != nil {
return time.Time{}, err
}
return time.Parse(layout, tmStr)
return time.ParseInLocation(layout, tmStr, time.Local)
}

type TimeLayoutDetector struct {
Expand Down

0 comments on commit 43c1b75

Please sign in to comment.