Skip to content

Instantly share code, notes, and snippets.

@dfang
Forked from vishakvkt/converters.go
Created April 25, 2018 05:53
Show Gist options
  • Save dfang/f1ffc08bb084b5a50c3b9a278e4ddedf to your computer and use it in GitHub Desktop.
Save dfang/f1ffc08bb084b5a50c3b9a278e4ddedf to your computer and use it in GitHub Desktop.
gorilla schema - convert html date
import(
"reflect"
"time"
"github.com/gorilla/schema"
)
func ConvertFormDate(value string) reflect.Value {
s, _ := time.Parse("2006-01-_2", value)
return reflect.ValueOf(s)
}
func usage() {
decoder := schema.NewDecoder()
decoder.RegisterConverter(time.Time{}, ConvertFormDate)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment