lib/ffi-icu/time_formatting.rb in ffi-icu-0.4.2 vs lib/ffi-icu/time_formatting.rb in ffi-icu-0.4.3

- old
+ new

@@ -252,10 +252,13 @@ # Manipulate the skeleton to make it work with the correct hour cycle. skeleton_str.gsub!(/[hHkKjJ]/, HOUR_CYCLE_SYMS[@hour_cycle]) # Either ensure the skeleton has, or does not have, am/pm, as appropriate if ['h11', 'h12'].include?(@hour_cycle) - skeleton_str << 'a' unless skeleton_str.include? 'a' + # Only actually append 'am/pm' if there is an hour in the format string + if skeleton_str =~ /[hHkKjJ]/ && !skeleton_str.include?('a') + skeleton_str << 'a' + end else skeleton_str.gsub!('a', '') end # Convert the skeleton back to a pattern