docbrown/app/helpers/date_helper.rb
arunkc 47908d7a87
Update format specifiers in readable_publish_date (#13660)
* Update format specifiers in readable_publish_date

* Trigger Travis manually

* Update format specifiers in readable_publish_date

* Update format specifiers in readable_publish_date

Co-authored-by: rhymes <rhymes@hey.com>
2021-05-07 08:51:49 +02:00

11 lines
306 B
Ruby

module DateHelper
def local_date(datetime, show_year: true)
datetime = Time.zone.parse(datetime) if datetime.is_a?(String)
tag.time(
datetime.strftime("%b %-e#{', %Y' if show_year}"),
datetime: datetime.utc.iso8601,
class: "date#{'-no-year' unless show_year}",
)
end
end