calendar_date_select 1.16.3 → 1.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,11 @@
1
+ == Version 1.16.4
2
+ * do not add to public if they are in app/assets. (Michael Grosser)
3
+ * action view helpers needs to be loaded first in order to as gem. (Sandip Ransing)
4
+ * Fixed bug with 2-digit hours. "10:00 AM" was being parsed as "1:00 AM". (Nathan B)
5
+
1
6
  == Version 1.16.3
2
- * hungarian translation added (raszi)
3
- * Workaround IE bug (mvastola)
7
+ * hungarian translation added. (raszi)
8
+ * Workaround IE bug. (mvastola)
4
9
 
5
10
  == Version 1.16.2
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.16.3
1
+ 1.16.4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{calendar_date_select}
8
- s.version = "1.16.3"
8
+ s.version = "1.16.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Shih-gian Lee", "Enrique Garcia Cota (kikito)", "Tim Charper", "Lars E. Hoeg"]
@@ -1,12 +1,13 @@
1
1
  require "calendar_date_select/calendar_date_select.rb"
2
2
  require "calendar_date_select/form_helpers.rb"
3
3
  require "calendar_date_select/includes_helper.rb"
4
+ require "action_view/helpers"
4
5
 
5
- if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
6
+ if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
6
7
  ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelpers)
7
8
  ActionView::Base.send(:include, CalendarDateSelect::FormHelpers)
8
9
  ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)
9
-
10
+
10
11
  # Filthy backwards compatibility hooks... grumble
11
12
  if ([Rails::VERSION::MAJOR, Rails::VERSION::MINOR] <=> [2, 2]) == -1
12
13
  ActionView::Helpers::InstanceTag.class_eval do
@@ -14,7 +15,7 @@ if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
14
15
  new(object_name, method_name, template_object, nil, object)
15
16
  end
16
17
  end
17
-
18
+
18
19
  else
19
20
  ActionView::Helpers::InstanceTag.class_eval do
20
21
  class << self; alias new_with_backwards_compatibility new; end
@@ -22,7 +23,7 @@ if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
22
23
  end
23
24
 
24
25
  # install files
25
- unless File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js')
26
+ if !File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js') and !File.exists?(RAILS_ROOT + '/app/assets/javascripts/calendar_date_select/calendar_date_select.js')
26
27
  ['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
27
28
  source = File.dirname(__FILE__) + "/../#{dir}"
28
29
  dest = RAILS_ROOT + dir
@@ -30,4 +31,4 @@ if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
30
31
  FileUtils.cp(Dir.glob(source+'/*.*'), dest)
31
32
  end
32
33
  end
33
- end
34
+ end
@@ -1,4 +1,4 @@
1
- // CalendarDateSelect version 1.16.3 - a prototype based date picker
1
+ // CalendarDateSelect version 1.16.4 - a prototype based date picker
2
2
  // Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
3
3
  if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
4
4
  if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required. If using earlier version of prototype, please use calendar_date_select version 1.8.3");
@@ -15,20 +15,20 @@ Date.parseFormattedString = function (string) {
15
15
  // 11/1/1111 01pm
16
16
  // 1/1/1111 01:11pm
17
17
  // 1/1/1111 1:11pm
18
- var regexp = "(([0-1]?[0-9])\/[0-3]?[0-9]\/[0-9]{4}) *([0-9]{1,2}(:[0-9]{2})? *(am|pm))?";
18
+ var regexp = "(([0-1]?[0-9])\/[0-3]?[0-9]\/[0-9]{4}) *(([0-9]{1,2})(:[0-9]{2})? *(am|pm))?";
19
19
  string = string.strip();
20
20
  var d = string.match(new RegExp(regexp, "i"));
21
21
  if (d==null) {
22
22
  return Date.parse(string); // Give javascript a chance to parse it.
23
23
  }
24
-
24
+
25
25
  mdy = d[1].split('/');
26
26
  hrs = 0;
27
27
  mts = 0;
28
28
  if(d[3] != null && d[3].strip() != "") {
29
- hrs = parseInt(d[3].split('')[0], 10);
30
- if(d[5].toLowerCase() == 'pm') { hrs += 12; } // Add 12 more to hrs
31
- mts = d[4].split(':')[1];
29
+ hrs = parseInt(d[3], 10);
30
+ if(d[6].toLowerCase() == 'pm') { hrs += 12; } // Add 12 more to hrs
31
+ mts = d[5].split(':')[1];
32
32
  }
33
33
 
34
34
  return new Date(mdy[2], parseInt(mdy[0], 10)-1, mdy[1], hrs, mts, 0);
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: calendar_date_select
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.16.3
5
+ version: 1.16.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Shih-gian Lee
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2010-03-29 00:00:00 -04:00
16
+ date: 2010-03-29 00:00:00 -07:00
17
17
  default_executable:
18
18
  dependencies: []
19
19
 
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements: []
105
105
 
106
106
  rubyforge_project:
107
- rubygems_version: 1.5.0
107
+ rubygems_version: 1.5.1
108
108
  signing_key:
109
109
  specification_version: 3
110
110
  summary: Calendar date picker for rails