multiparameter_date_time 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module MultiparameterDateTime
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  VALID_TIME_FORMAT = /\A\d?\d:\d{2}(:\d{2})?\s*([ap]m)?\s*([A-Z]{3,5})?\Z/
9
- VALID_DATE_FORMAT = /\A\d?\d\/\d?\d\/\d{4}|(\d{4}-\d{2}-\d{2})\Z/
9
+ VALID_DATE_FORMAT = /\A((\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4})|(\d{4}-\d{2}-\d{2}))\Z/
10
10
 
11
11
  DEFAULT_DATE_FORMAT = "%-m/%-d/%Y"
12
12
  DEFAULT_TIME_FORMAT = "%-I:%M %P"
@@ -1,3 +1,3 @@
1
1
  module MultiparameterDateTime
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/multiparameter_date_time/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Case Commons, LLC", "Grant Hutchins", "Trace Wax"]
6
- gem.email = ["casecommons-dev@googlegroups.com", "gems@nertzy.com", "gems@tracedwax.com"]
5
+ gem.authors = ["Case Commons, LLC", "Grant Hutchins", "Trace Wax", "Jason Berlinsky"]
6
+ gem.email = ["casecommons-dev@googlegroups.com", "gems@nertzy.com", "gems@tracedwax.com", "jason@jasonberlinsky.com"]
7
7
  gem.summary = "Set a DateTime via two accessors, one for the date, one for the time"
8
8
  gem.homepage = "https://github.com/Casecommons/multiparameter_date_time"
9
9
 
@@ -234,4 +234,20 @@ describe IsValidMultiparameterDateTimeValidator do
234
234
  end
235
235
  end
236
236
 
237
+ context "accepts dates in a variety of formats" do
238
+ ["02-01-1971", "4/4/92", "01/02/2001", "01/02/2001", "01.02.2011"].each do |format|
239
+ context format do
240
+ let(:date_string) { format }
241
+ let(:time_string) { "12:00am" }
242
+ let(:record) do
243
+ ModelWithDatetime.new(foo_date_part: date_string, foo_time_part: time_string)
244
+ end
245
+
246
+ it "should be accepted" do
247
+ record.should be_valid
248
+ end
249
+ end
250
+ end
251
+ end
252
+
237
253
  end
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiparameter_date_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Case Commons, LLC
9
9
  - Grant Hutchins
10
10
  - Trace Wax
11
+ - Jason Berlinsky
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2012-08-10 00:00:00.000000000 Z
15
+ date: 2012-08-13 00:00:00.000000000 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: american_date
@@ -114,6 +115,7 @@ email:
114
115
  - casecommons-dev@googlegroups.com
115
116
  - gems@nertzy.com
116
117
  - gems@tracedwax.com
118
+ - jason@jasonberlinsky.com
117
119
  executables: []
118
120
  extensions: []
119
121
  extra_rdoc_files: []
@@ -144,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
146
  version: '0'
145
147
  segments:
146
148
  - 0
147
- hash: 340950943914695248
149
+ hash: -41403357977053556
148
150
  required_rubygems_version: !ruby/object:Gem::Requirement
149
151
  none: false
150
152
  requirements:
@@ -153,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
155
  version: '0'
154
156
  segments:
155
157
  - 0
156
- hash: 340950943914695248
158
+ hash: -41403357977053556
157
159
  requirements: []
158
160
  rubyforge_project:
159
161
  rubygems_version: 1.8.24