Sha256: 4f51abb0f3c74cc1c891d9289c93553f1d193b57781bc3472b98a80d692a1dbf

Contents?: true

Size: 464 Bytes

Versions: 16

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

# WorksCited extensions to Time
class Time
  def mla_date
    month_name = strftime('%B')
    return strftime('%e %B %Y') if month_name.length < 5

    strftime('%e %b. %Y')
  end

  def mla_datetime
    month_name = strftime('%B')
    time = if month_name.length < 5
             strftime('%e %B %Y, %l:%M %P')
           else
             strftime('%e %b. %Y, %l:%M %P')
           end
    time.gsub(/([ap])m/, '\\1.m.')
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
works_cited-0.1.16 lib/works_cited/extensions/time.rb
works_cited-0.1.15 lib/works_cited/extensions/time.rb
works_cited-0.1.14 lib/works_cited/extensions/time.rb
works_cited-0.1.13 lib/works_cited/extensions/time.rb
works_cited-0.1.11 lib/works_cited/extensions/time.rb
works_cited-0.1.10 lib/works_cited/extensions/time.rb
works_cited-0.1.9 lib/works_cited/extensions/time.rb
works_cited-0.1.8 lib/works_cited/extensions/time.rb
works_cited-0.1.7 lib/works_cited/extensions/time.rb
works_cited-0.1.6 lib/works_cited/extensions/time.rb
works_cited-0.1.5 lib/works_cited/extensions/time.rb
works_cited-0.1.4 lib/works_cited/extensions/time.rb
works_cited-0.1.3 lib/works_cited/extensions/time.rb
works_cited-0.1.2 lib/works_cited/extensions/time.rb
works_cited-0.1.1 lib/works_cited/extensions/time.rb
works_cited-0.1.0 lib/works_cited/extensions/time.rb