fix/change string to time.Time where possible
This commit is contained in:
		
							
								
								
									
										10
									
								
								core.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								core.go
									
									
									
									
									
								
							@@ -4,6 +4,8 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type CommonResponse struct {
 | 
			
		||||
@@ -99,3 +101,11 @@ func isZero(v interface{}) (bool, error) {
 | 
			
		||||
	}
 | 
			
		||||
	return v == reflect.Zero(t).Interface(), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TimeFromString(t *testing.T, datetime string) time.Time {
 | 
			
		||||
	dt, err := time.Parse("2006-01-02T15:04:05Z", datetime)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Errorf("error when parsing time: %s", err)
 | 
			
		||||
	}
 | 
			
		||||
	return dt
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user