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

Support time.Time on form binding #801

Merged
merged 1 commit into from
Feb 17, 2017
Merged

Support time.Time on form binding #801

merged 1 commit into from
Feb 17, 2017

Conversation

andreynering
Copy link
Contributor

It's required to inform the format:

type T struct{
        Time time.Time `form:"a_time" time_format:"02/01/2006"`
}

The default location is time.Local. If a utc tag is given, localtion is time.UTC:

type T struct{
        Time time.Time `form:"a_time" time_format:"02/01/2006" utc:"1"`
}

If user input is blank (""), then form.Time.IsZero() will return true.

@codecov-io
Copy link

Codecov Report

Merging #801 into develop will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop     #801   +/-   ##
========================================
  Coverage    93.35%   93.35%           
========================================
  Files           16       16           
  Lines         1324     1324           
========================================
  Hits          1236     1236           
  Misses          78       78           
  Partials        10       10

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 2ae8a25...7a4fd34. Read the comment docs.

@appleboy
Copy link
Member

@tboerger @javierprovecho help to review this.

@appleboy appleboy merged commit 8632480 into gin-gonic:develop Feb 17, 2017
@andreynering andreynering deleted the form-time-binding branch February 17, 2017 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants