Mercurial > gemma
diff pkg/models/common.go @ 2059:ae0021feaac8 unify_imports
Imports: Made stretch import marshable (even if it is not needed).
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 29 Jan 2019 08:28:50 +0100 |
parents | 0bc0312105e4 |
children | 2c67c51d57ad |
line wrap: on
line diff
--- a/pkg/models/common.go Mon Jan 28 20:35:14 2019 +0100 +++ b/pkg/models/common.go Tue Jan 29 08:28:50 2019 +0100 @@ -20,6 +20,8 @@ "fmt" "strings" "time" + + "gemma.intevation.de/gemma/pkg/common" ) var ( @@ -30,8 +32,6 @@ // WGS84 is the EPSG of the World Geodetic System 1984. const WGS84 = 4326 -const DateFormat = "2006-01-02" - type ( Date struct{ time.Time } // Country is a valid country 2 letter code. @@ -41,7 +41,7 @@ ) func (srd Date) MarshalJSON() ([]byte, error) { - return json.Marshal(srd.Format(DateFormat)) + return json.Marshal(srd.Format(common.DateFormat)) } func (srd *Date) UnmarshalJSON(data []byte) error { @@ -49,7 +49,7 @@ if err := json.Unmarshal(data, &s); err != nil { return err } - d, err := time.Parse(DateFormat, s) + d, err := time.Parse(common.DateFormat, s) if err == nil { *srd = Date{d} }