Skip to content

Commit

Permalink
Merge 5eed61f into cda8175
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjia committed Dec 6, 2016
2 parents cda8175 + 5eed61f commit 4b48a9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rails_admin/support/datetime.rb
Expand Up @@ -39,11 +39,11 @@ def delocalize(date_string, format)
english = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
abbr_day_names.each_with_index { |d, i| date_string = date_string.gsub(/#{d}/, english[i]) }
when '%B'
english = [nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][1..-1]
month_names.each_with_index { |m, i| date_string = date_string.gsub(/#{m}/, english[i]) }
english = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"].reverse
month_names.reverse.each_with_index { |m, i| date_string = date_string.gsub(/#{m}/, english[i]) }
when '%b'
english = [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][1..-1]
abbr_month_names.each_with_index { |m, i| date_string = date_string.gsub(/#{m}/, english[i]) }
english = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].reverse
abbr_month_names.reverse.each_with_index { |m, i| date_string = date_string.gsub(/#{m}/, english[i]) }
when '%p'
date_string = date_string.gsub(/#{::I18n.t('date.time.am', default: "am")}/, 'am')
date_string = date_string.gsub(/#{::I18n.t('date.time.pm', default: "pm")}/, 'pm')
Expand Down

0 comments on commit 4b48a9c

Please sign in to comment.