kiss 1.8 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8
1
+ 1.8.1
Binary file
@@ -106,7 +106,7 @@ class Kiss
106
106
  def value_string
107
107
  return param if param
108
108
  v = self.value
109
- v *= @_factor if v && @_factor
109
+ v /= @_factor if v && @_factor
110
110
  value_to_s(v)
111
111
  end
112
112
 
@@ -140,10 +140,10 @@ class Kiss
140
140
 
141
141
  begin
142
142
  p = @_format.validate(param, @_form.context)
143
- p *= @_factor if @_factor
143
+ p *= @_factor if p && @_factor
144
144
  value = p
145
145
  rescue Kiss::Format::ValidateError => e
146
- return add_error("#{e.message.capitalize}.")
146
+ return add_error("#{label.capitalize} #{e.message}.")
147
147
  end
148
148
 
149
149
  if @_min_value_size && value.size < @_min_value_size
@@ -137,7 +137,7 @@ class Kiss
137
137
  value
138
138
  end
139
139
  end
140
-
140
+
141
141
  def value_to_s(value, context = {})
142
142
  convert_value_utc_to_local(value, context).strftime("%m/%d/%Y %I:%M %p").gsub(/0(\d[\:\/])/, '\1')
143
143
  end
@@ -155,15 +155,19 @@ class Kiss
155
155
  @_input_width = 80
156
156
 
157
157
  def self.value_to_s(value, context = {})
158
- value.strftime("%m/%d/%Y")
158
+ convert_value_utc_to_local(value, context).strftime("%m/%d/%Y").gsub(/0(\d[\:\/])/, '\1')
159
159
  end
160
160
  end
161
161
 
162
162
  class Time < DateTime
163
- @_regexp = /\A\d+\:\d+\s*[ap]m\Z/i,
163
+ @_regexp = /\A\d{1,2}(\:\d{2})?\s*[ap]m\Z/i
164
164
  @_error = 'must be a valid time'
165
165
  @_legend = 'h:mm a/pm'
166
166
  @_input_width = 80
167
+
168
+ def self.value_to_s(value, context = {})
169
+ convert_value_utc_to_local(value, context).strftime("%I:%M %p").gsub(/0(\d[\:\/])/, '\1')
170
+ end
167
171
  end
168
172
 
169
173
  class MonthYear < Date
metadata CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 8
8
- version: "1.8"
8
+ - 1
9
+ version: 1.8.1
9
10
  platform: ruby
10
11
  authors:
11
12
  - Shawn Van Ittersum