Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localized dates / time for shared/attributes/date_and_time #980

Open
lcorneliussen opened this issue Dec 8, 2024 · 1 comment
Open

Localized dates / time for shared/attributes/date_and_time #980

lcorneliussen opened this issue Dec 8, 2024 · 1 comment

Comments

@lcorneliussen
Copy link

lcorneliussen commented Dec 8, 2024

Dates helper hard-references multiple date formats, which would be nice to have localizable.

  • %B %-d for same year
  • %B %-d, %Y for different year
  • %l:%M %p for time
  • Today at {time} as date replacement for today
  • Yesterday at {time} as date replacement for yesterday
  • {date} at {time} for date/time combination

Also t('global.formats.timestamp_unavailable') is used as a fallback if there is no timestamp.

Changes proposed:

  • Use global.dates.today for today
  • Add global.dates.yesterday for yesterday
  • Move Today/Yesterday to date_format and use timestamp_date_and_time to combine date and time
  • Add %B %-d, %Y as formats.date_long and %B %-d as formats.date_long_without_year
  • Add %l:%M %pas formats.time
    dates:
      today: Today
+     yesterday: Yesterday
      day:
        one: 1 Day
        other: '%{count} Days'
      last_month: Last Month
      last_week: Last Week
      last_day:
        one: Last Day
        other: Last %{count} Days
    formats:
      timestamp_unavailable: Never
+     timestamp_date_and_time: '%{date} at %{time}'
      date: '%m/%d/%Y'
      date_and_time: '%m/%d/%Y %l:%M %p'
+     time: '%l:%M %p'
+     date_long: '%B %-d, %Y'
+     date_long_without_year: '%B %-d'

Relevant files:

@jagthedrummer
Copy link
Contributor

Hey, @lcorneliussen, this sounds like a reasonable proposal. I think we'd welcome a PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants