Skip to content

Commit

Permalink
Fix localization error
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Jun 24, 2024
1 parent e427cba commit bcb9a15
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/redmine_datetime_custom_field/application_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

module RedmineDatetimeCustomField
module ApplicationHelperPatch
def format_object(object, html=true, &block)
if (object.class.name=='CustomValue' || object.class.name== 'CustomFieldValue') && object.custom_field
def format_object(object, html = true, &block)
if (object.class.name == 'CustomValue' || object.class.name == 'CustomFieldValue') && object.custom_field
return "" unless object.customized&.visible?
f = object.custom_field.format.formatted_custom_value(self, object, html)
if f.nil? || f.is_a?(String)
f
else
if f.class.name=='Time'
if f.class.name == 'Time'
format_time_without_zone(f)
else
super
Expand All @@ -24,7 +24,7 @@ def format_object(object, html=true, &block)
end
end

def calendar_for(field_id, showHours=nil)
def calendar_for(field_id, showHours = nil)
include_calendar_headers_tags
javascript_tag("$(function() {" +
(showHours ? "datetimepickerOptions.timepicker=true; datetimepickerOptions.format='d/m/Y H:i';" : "datetimepickerOptions.timepicker=false;datetimepickerOptions.format='d/m/Y';") +
Expand Down Expand Up @@ -83,7 +83,6 @@ def format_time_without_zone(time, include_date = true)
return nil unless time
options = {}
options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format)
options[:locale] = User.current.language unless User.current.language.blank?
time = time.to_time if time.is_a?(String)
(include_date ? "#{format_date(time)} " : "") + ::I18n.l(time, **options)
end
Expand Down

0 comments on commit bcb9a15

Please sign in to comment.