xormplus 10 лет назад
Родитель
Сommit
2484a741e1
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      helpersplus.go

+ 2 - 2
helpersplus.go

@@ -30,7 +30,7 @@ func reflect2objectWithDateFormat(rawValue *reflect.Value, dateFormat string) (v
 		}
 	//时间类型
 	case reflect.Struct:
-		if aa == core.TimeType {
+		if aa.ConvertibleTo(core.TimeType) {
 			//			loc, _ := time.LoadLocation("Local")                            //重要:获取时区
 			//			value, _ = time.ParseInLocation(dateFormat, rawValue.Interface().(time.Time).Format(dateFormat), loc)
 			value = rawValue.Interface().(time.Time).Format(dateFormat)
@@ -179,7 +179,7 @@ func reflect2object(rawValue *reflect.Value) (value interface{}, err error) {
 		}
 	//时间类型
 	case reflect.Struct:
-		if aa == core.TimeType {
+		if aa.ConvertibleTo(core.TimeType) {
 			value = rawValue.Interface().(time.Time)
 		} else {
 			err = fmt.Errorf("Unsupported struct type %v", vv.Type().Name())