Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use time.formats.alchemy.default for datetime view #3001

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/components/alchemy/ingredients/datetime_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class DatetimeView < BaseView
attr_reader :date_format

# @param ingredient [Alchemy::Ingredient]
# @param date_format [String] The date format to use. Use either a strftime format string, a I18n format symbol or "rfc822".
def initialize(ingredient, date_format: nil, html_options: {})
# @param date_format [String] The date format to use. Use either a strftime format string, a I18n format symbol or "rfc822". Defaults to "time.formats.alchemy.default".
def initialize(ingredient, date_format: :"alchemy.default", html_options: {})
super(ingredient)
@date_format = settings_value(:date_format, value: date_format)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/views/alchemy/ingredients/datetime_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
context "without date_format passed" do
it "translates the date value with default format" do
render ingredient, options: options
expect(rendered).to have_content("Sun, 27 Oct 2013 20:14:16 +0000")
expect(rendered).to have_content("10.27.2013 20:14")
end
end

Expand Down