Add I18n date format example (#14973)
This commit is contained in:
parent
b898bd3882
commit
e3abee660a
3 changed files with 22 additions and 13 deletions
|
|
@ -1,9 +1,10 @@
|
|||
module DateHelper
|
||||
def local_date(datetime, show_year: true)
|
||||
datetime = Time.zone.parse(datetime) if datetime.is_a?(String)
|
||||
format = show_year ? :short_with_year : :short
|
||||
|
||||
tag.time(
|
||||
datetime.strftime("%b %-e#{', %Y' if show_year}"),
|
||||
l(datetime, format: format),
|
||||
datetime: datetime.utc.iso8601,
|
||||
class: "date#{'-no-year' unless show_year}",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -112,3 +112,7 @@ en:
|
|||
billing: "Billing"
|
||||
organization: "Organization"
|
||||
extensions: "Extensions"
|
||||
time:
|
||||
formats:
|
||||
short: "%b %-e"
|
||||
short_with_year: "%b %-e, %Y"
|
||||
|
|
|
|||
|
|
@ -67,18 +67,18 @@ fr:
|
|||
date:
|
||||
abbr_month_names:
|
||||
-
|
||||
- Janv
|
||||
- Fevr
|
||||
- Mars
|
||||
- Avril
|
||||
- Mai
|
||||
- Juin
|
||||
- Juil
|
||||
- Aout
|
||||
- Sept
|
||||
- Oct
|
||||
- Nov
|
||||
- Dec
|
||||
- janv
|
||||
- févr
|
||||
- mars
|
||||
- avril
|
||||
- mai
|
||||
- juin
|
||||
- juil
|
||||
- aout
|
||||
- sept
|
||||
- oct
|
||||
- nov
|
||||
- déc
|
||||
errors:
|
||||
messages:
|
||||
accepted: doit être accepté
|
||||
|
|
@ -135,3 +135,7 @@ fr:
|
|||
billing: Facturation
|
||||
organization: Organisation
|
||||
extensions: Extensions
|
||||
time:
|
||||
formats:
|
||||
short: "%-e %b"
|
||||
short_with_year: "%-e %b, %Y"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue