mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	fix timezone
This commit is contained in:
		@@ -82,7 +82,8 @@ type Action struct {
 | 
				
			|||||||
func (a *Action) AfterSet(colName string, _ xorm.Cell) {
 | 
					func (a *Action) AfterSet(colName string, _ xorm.Cell) {
 | 
				
			||||||
	switch colName {
 | 
						switch colName {
 | 
				
			||||||
	case "created":
 | 
						case "created":
 | 
				
			||||||
		a.Created = a.Created.UTC()
 | 
							now := time.Now()
 | 
				
			||||||
 | 
							a.Created = a.Created.Add(now.Sub(now.UTC()))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -93,7 +93,8 @@ func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
 | 
				
			|||||||
			log.Error(3, "GetUserByID[%d]: %v", i.ID, err)
 | 
								log.Error(3, "GetUserByID[%d]: %v", i.ID, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	case "created":
 | 
						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":
 | 
						case "created":
 | 
				
			||||||
		fmt.Println(1, c.Created)
 | 
							now := time.Now()
 | 
				
			||||||
 | 
							c.Created = c.Created.Add(now.Sub(now.UTC()))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -273,7 +273,6 @@ func TimeSincePro(then time.Time) string {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func timeSince(then time.Time, lang string) string {
 | 
					func timeSince(then time.Time, lang string) string {
 | 
				
			||||||
	now := time.Now()
 | 
						now := time.Now()
 | 
				
			||||||
	fmt.Println(2, now)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	lbl := i18n.Tr(lang, "tool.ago")
 | 
						lbl := i18n.Tr(lang, "tool.ago")
 | 
				
			||||||
	diff := now.Unix() - then.Unix()
 | 
						diff := now.Unix() - then.Unix()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user