Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Merge requests
  • !570

Feature/localized dates

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/nburkley/feature/localized-dates into master May 08, 2016
  • Overview 9
  • Commits 2
  • Pipelines 0
  • Changes 5

Created by: nburkley

Currently there's no control over the display format of the DateTimes in Administrate. This pull request adds a format option to a Field::DateTime field. e.g.

created_at: Field::DateTime.with_options(format: :short)

By default, if no option is passed the default format is used - which is was is done implicitly currently.

Alternatively, formats can be added to the in the local yaml files and referred to by key e.g.

en:
   date:
      formats:
         year_only: "%Y"
created_at: Field::DateTime.with_options(format: :year_only)

Format strings can also be used:

created_at: Field::DateTime.with_options(format: "%Y")

I re-used the with_translations helper to isolate the formats defined in any en.yml files. I moved it into a module to make it easier to reuse.

Let me know what you think.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/nburkley/feature/localized-dates