Parcourir la source

设置null时间值为1970-01-01

huangrf il y a 5 ans
Parent
commit
2e97f84486
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      models/LocalTime.go

+ 2 - 2
models/LocalTime.go

@@ -13,7 +13,7 @@ func init() {
 
 const (
 	timeFormat = "2006-01-02 15:04:05"
-	zeroTime   = "0001-01-01 00:00:00"
+	zeroTime   = "1970-01-01 00:00:00"
 )
 
 func NowLocal() LocalTime {
@@ -42,7 +42,7 @@ func (t *LocalTime) UnmarshalJSON(data []byte) error {
 
 	if len(dataStr) > 19 {
 		dataStr = dataStr[0:19]
-		if dataStr == "0001-01-01 00:00:00" {
+		if dataStr == "1970-01-01 00:00:00" {
 			dataStr = timeFormat
 		}
 	} else if len(dataStr) == 10 {