Skip to content

Commit

Permalink
fix: fix timezone bug AlistGo/alist#6704
Browse files Browse the repository at this point in the history
  • Loading branch information
SheltonZhu committed Aug 6, 2024
1 parent ce80aa4 commit 2affdaa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/driver/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func (f *File) from(fileInfo *FileInfo) *File {
f.FileID = fileInfo.FileID
f.ParentID = string(fileInfo.CategoryID)
f.IsDirectory = false
localTime, err := time.ParseInLocation("2006-01-02 15:04", fileInfo.UpdateTime, time.Local)
loc, _ := time.LoadLocation("Asia/Shanghai") // updatetime is a string without timezone
localTime, err := time.ParseInLocation("2006-01-02 15:04", fileInfo.UpdateTime, loc)
if err == nil {
f.UpdateTime = time.Unix(localTime.Unix(), 0)
}
Expand Down

1 comment on commit 2affdaa

@SheltonZhu
Copy link
Owner Author

@SheltonZhu SheltonZhu commented on 2affdaa Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.