Skip to content

Instantly share code, notes, and snippets.

@vishakvkt
Last active April 25, 2018 05:53
Show Gist options
  • Save vishakvkt/c15ac55a677b432a099d to your computer and use it in GitHub Desktop.
Save vishakvkt/c15ac55a677b432a099d 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)
}
@yubing24
Copy link

Very nice. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment