lib/timeliness/parser.rb in timeliness-0.1.0 vs lib/timeliness/parser.rb in timeliness-0.1.1
- old
+ new
@@ -10,14 +10,15 @@
type = args.first
time_array = _parse(value, type, options)
return nil if time_array.nil?
- if type == :date
+ case type
+ when :date
time_array[3..7] = nil
- elsif type == :time
+ when :time
time_array[0..2] = current_date(options)
- elsif type.nil?
+ when nil
dummy_date = current_date(options)
time_array[0] ||= dummy_date[0]
time_array[1] ||= dummy_date[1]
time_array[2] ||= dummy_date[2]
end