Skip to content

Commit 923d73e

Browse files
authored
Add support for '%-l' option to Flatpickr. (#3616)
We currently support the options '%-d', '%-H', '%-I', '%-M', '%-m', '%-S', but not '%-l'. Adding '%-l' will prevent an error to be raised when the Ruby format uses this option.
1 parent 2a89ebc commit 923d73e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/rails_admin/support/datetime.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Datetime
2121
'%-I' => 'h', # Hour of the day, 12-hour clock (1..12)
2222
'%k' => 'H', # Hour of the day, 24-hour clock (0..23)
2323
'%l' => 'h', # Hour of the day, 12-hour clock (1..12)
24+
'%-l' => 'h', # Hour of the day, 12-hour clock (1..12)
2425
'%M' => 'i', # Minute of the hour (00..59)
2526
'%-M' => 'i', # Minute of the hour (00..59)
2627
'%m' => 'm', # Month of the year (01..12)

spec/rails_admin/support/datetime_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'%Y-%m-%dT%H:%M:%S%:z' => 'Y-m-d\TH:i:S+00:00',
1414
'%HH%MM%SS' => 'H\Hi\MS\S',
1515
'a%-Ha%-Ma%-Sa%:za' => '\aH\ai\as\a+00:00\a',
16+
'%B %-d at %-l:%M %p' => 'F j \a\t h:i K',
1617
}.each do |strftime_format, flatpickr_format|
1718
it "convert strftime_format to flatpickr_format - example #{strftime_format}" do
1819
expect(RailsAdmin::Support::Datetime.to_flatpickr_format(strftime_format)).to eq flatpickr_format

0 commit comments

Comments
 (0)