From fb5262159604d1a13ce30786e0d62133dd92f573 Mon Sep 17 00:00:00 2001 From: Ivan Zotov Date: Tue, 26 Jan 2016 15:22:23 +0300 Subject: [PATCH] Fix momentjs translations for '%-d' format day of the month --- lib/rails_admin/support/datetime.rb | 1 + spec/rails_admin/support/datetime_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/rails_admin/support/datetime.rb b/lib/rails_admin/support/datetime.rb index 0f1913d74d..a1ef20388d 100644 --- a/lib/rails_admin/support/datetime.rb +++ b/lib/rails_admin/support/datetime.rb @@ -10,6 +10,7 @@ class Datetime '%b' => 'MMM', # The abbreviated month name ("Jan") '%B' => 'MMMM', # The full month name ("January") '%d' => 'DD', # Day of the month (01..31) + '%-d' => 'D', # Day of the month (1..31) '%D' => 'MM/DD/YY', # American date format mm/dd/yy '%e' => 'D', # Day of the month (1..31) '%F' => 'YY-MM-DD', # ISO 8601 date format diff --git a/spec/rails_admin/support/datetime_spec.rb b/spec/rails_admin/support/datetime_spec.rb index c5c5a26bec..b88e5a629d 100644 --- a/spec/rails_admin/support/datetime_spec.rb +++ b/spec/rails_admin/support/datetime_spec.rb @@ -8,6 +8,7 @@ '%D de %M de %Y, %H:%M:%S' => 'MM/DD/YY [de] mm [de] YYYY, HH:mm:ss', '%d/%-m/%Y, %H:%M:%S' => 'DD/M/YYYY, HH:mm:ss', '%d de %B de %Y' => 'DD [de] MMMM [de] YYYY', + '%-d %B %Y' => 'D MMMM YYYY', }.each do |strftime_format, momentjs_format| it "convert strftime_format to momentjs_format - example #{strftime_format}" do strftime_format = RailsAdmin::Support::Datetime.new(strftime_format)