Module: Pubid::Rendering::Date
- Included in:
- Base
- Defined in:
- lib/pubid/rendering/date.rb
Instance Method Summary collapse
-
#render_date(date, **options) ⇒ String
Render date with optional month/day.
Instance Method Details
#render_date(date, **options) ⇒ String
Render date with optional month/day
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pubid/rendering/date.rb', line 10 def render_date(date, **) return "" unless date&.year result = ":#{date.year}" if date.month && [:include_month] result += "-#{format('%02d', date.month)}" end if date.day && [:include_day] result += "-#{format('%02d', date.day)}" end result end |