stympy/faker — pull request #279 by CarlosRoque (2014-11-19 22:17:21+00:00)
Title: Added a format to Time between,backward and forward to return a string formatted for US users.

Added a format to Time between,backward and forward to return a string formatted for US users. This is useful when testing time pickers

Because some date pickers return dates in this format: "12/23/2014 10:30 AM". When testing controllers that can handle this format we have to pass that formatted string to patch create and post update. Something like :

start_date = Faker::Time.between(2.days.ago, Time.now, :all,:us)
end_date = Faker::Time.between(2.days.ago, Time.now, :all,:us)
post :create,{ job: attributes_for(:job, start_date: start_date, end_date: end_date)}

that is nicer than having to do

start_date = I18n.l(DateTime.parse(Faker::Time.between(2.days.ago, Time.now, :all).to_s )
...

I needed this when testing a controller with rspec that received a date from a form that used the gem bootstrap3-datetimepicker-rails

this can be expanded to add more formats by adding them to the locales files