Method: TimeZoneAble#local_date
- Defined in:
- lib/app/models/concerns/time_zone_able.rb
#local_date(date, format = :medium, default = 'N/A') ⇒ Object
Return the given time in the localized time for this object
33 34 35 36 37 38 |
# File 'lib/app/models/concerns/time_zone_able.rb', line 33 def local_date(date, format = :medium, default = 'N/A') tz = TZInfo::Timezone.get(time_zone || 'GMT') date.present? ? I18n.l(date.in_time_zone(tz).to_date, format: format) : default rescue StandardError default end |