Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default time format in form binding #1487

Merged

Conversation

lokhman
Copy link
Contributor

@lokhman lokhman commented Aug 14, 2018

To make things working in line with encoding/json decoder, I'd suggest to set default time format as time.RFC3339.

type input struct {
	Field time.Time `form:"field" json:"time"`
}

This will make values bound in the same way as if you are using structures as above and different bindings depending on the request type.

@codecov
Copy link

codecov bot commented Aug 14, 2018

Codecov Report

Merging #1487 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1487   +/-   ##
=======================================
  Coverage   99.15%   99.15%           
=======================================
  Files          36       36           
  Lines        1894     1894           
=======================================
  Hits         1878     1878           
  Misses         13       13           
  Partials        3        3
Impacted Files Coverage Δ
binding/form_mapping.go 98.54% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 40ab9de...d52ec94. Read the comment docs.

@appleboy appleboy added this to the 1.4 milestone Aug 14, 2018
@thinkerou
Copy link
Member

@lokhman thanks, LGTM

@appleboy appleboy merged commit 7eb0f74 into gin-gonic:master Aug 17, 2018
@lokhman lokhman deleted the features/form-binding-default-time-format branch August 17, 2018 08:47
salamer pushed a commit to salamer/gin that referenced this pull request Aug 18, 2018
@thinkerou thinkerou mentioned this pull request Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants