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

Use I18n date format for pretty_time helper #2419

Merged
merged 2 commits into from
Dec 12, 2017

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Dec 1, 2017

Instead of concatenating strings we should use a i18n date format instead.

Also introduces support for custom Solidus' time formats. Currently we are using the Rails :long date format that Rails apps and extensions might override. Instead we use our own solidus namespace to avoid conflicts.

en:
  time:
    formats:
      solidus:
        long: ...

@tvdeyen tvdeyen added the WIP label Dec 1, 2017
@tvdeyen tvdeyen self-assigned this Dec 1, 2017
@solidusio solidusio deleted a comment from houndci-bot Dec 1, 2017
@tvdeyen
Copy link
Member Author

tvdeyen commented Dec 1, 2017

Build errors will be fixed by #2423

@tvdeyen tvdeyen removed their assignment Dec 1, 2017
@tvdeyen tvdeyen removed the WIP label Dec 1, 2017
Instead of concatinating strings we should use a i18n date format
instead.
Instead of only using a long version we add a short version too. You can add your own solidus time format by adding a format to

    your-locale:
      time:
        formats:
          solidus:
            iso: '%F'

and use it with `pretty_time(record.created_at, :iso)`.
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense, thanks!

@tvdeyen tvdeyen merged commit b807318 into solidusio:master Dec 12, 2017
@tvdeyen tvdeyen deleted the prettier-time branch December 12, 2017 08:22
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

Successfully merging this pull request may close these issues.

3 participants