]> source.dussan.org Git - gitea.git/commitdiff
fix timezone
authorUnknwon <u@gogs.io>
Wed, 19 Aug 2015 16:32:18 +0000 (00:32 +0800)
committerUnknwon <u@gogs.io>
Wed, 19 Aug 2015 16:32:18 +0000 (00:32 +0800)
models/action.go
models/issue.go
modules/base/tool.go

index 0e336c372b4c3adfc24fd620b1a2c3bb9a02f853..2c08eebbd98c989559fb2f0a6398d5509c038178 100644 (file)
@@ -82,7 +82,8 @@ type Action struct {
 func (a *Action) AfterSet(colName string, _ xorm.Cell) {
        switch colName {
        case "created":
-               a.Created = a.Created.UTC()
+               now := time.Now()
+               a.Created = a.Created.Add(now.Sub(now.UTC()))
        }
 }
 
index 75345217c49f84ec15a6bacf655dd9de4e3a234c..5e5c79c2e5d235cae5d88102ed7d872336d65ed3 100644 (file)
@@ -93,7 +93,8 @@ func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
                        log.Error(3, "GetUserByID[%d]: %v", i.ID, err)
                }
        case "created":
-               i.Created = i.Created.UTC()
+               now := time.Now()
+               i.Created = i.Created.Add(now.Sub(now.UTC()))
        }
 }
 
@@ -1359,7 +1360,8 @@ func (c *Comment) AfterSet(colName string, _ xorm.Cell) {
                        }
                }
        case "created":
-               fmt.Println(1, c.Created)
+               now := time.Now()
+               c.Created = c.Created.Add(now.Sub(now.UTC()))
        }
 }
 
index abf12791d3fb79f42f7ee64caa11db9186bd7590..16759f21f6a9d5c4195ce5d2d9b6379a5df47581 100644 (file)
@@ -273,7 +273,6 @@ func TimeSincePro(then time.Time) string {
 
 func timeSince(then time.Time, lang string) string {
        now := time.Now()
-       fmt.Println(2, now)
 
        lbl := i18n.Tr(lang, "tool.ago")
        diff := now.Unix() - then.Unix()