date_params 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # DateParams
2
2
 
3
+ [![Build Status](https://travis-ci.org/LessonPlanet/date_params.png)](https://travis-ci.org/LessonPlanet/date_params)
4
+
3
5
  Dates and times passed in as strings date-pickers or time-pickers need to be
4
6
  converted from their string format to a ruby Date or DateTime to be able to be saved
5
7
  and manipulated. This gem provides two simple controller add-ons to
@@ -14,8 +14,8 @@ class DateParams::Parser
14
14
  @param = param
15
15
  @options = options
16
16
  @params = params
17
- @date_format = options.fetch :date_format, '%m/%d/%Y'
18
- @time_format = options.fetch :time_format, '%I:%M %p'
17
+ @date_format = options.fetch :date_format, default_date_format
18
+ @time_format = options.fetch :time_format, default_time_format
19
19
  end
20
20
 
21
21
  def parse_date_param!(field = param)
@@ -48,6 +48,16 @@ class DateParams::Parser
48
48
  traversed_params[fields[:field]] = datetime if datetime
49
49
  end
50
50
 
51
+ protected
52
+
53
+ def default_date_format
54
+ '%m/%d/%Y'
55
+ end
56
+
57
+ def default_time_format
58
+ '%I:%M %p'
59
+ end
60
+
51
61
  private
52
62
 
53
63
  def traversed_params
@@ -1,3 +1,3 @@
1
1
  module DateParams
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date_params
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-03 00:00:00.000000000 Z
12
+ date: 2013-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport