Skip to content

Conversation

@goosys
Copy link
Contributor

@goosys goosys commented Feb 19, 2025

  • refs Refactor Time-related Fields ahead of upcoming improvements #2702
  • The only way to change the time format was to modify the Rails default setting. However, changing it would also affect other parts of the application outside the admin panel. Therefore, I added a dedicated format specifically for Administrate.
    • administrate_date_default administrate_datetime_default administrate_time_default
  • Currently, the Time format is fixed as "%I:%M%p", but in Japanese, we would prefer the order "%p %I:%M". I believe other languages may also have their own preferred orders. I have made it possible to change this for each language using administrate_time_default .

@goosys
Copy link
Contributor Author

goosys commented Feb 19, 2025

At this point, there is a backward compatibility issue.

Since administrate_*_default does not exist in everyone's Rails setup, some initial configuration is required to start using this feature. I feel bad about forcing this initial setup on everyone, so I’d like to discuss if there’s a better way.

  1. Write the configuration values for each language in all config/locales/administrate.*.yml files.
  2. Create config/locales/date.yml and include only the default (en) settings.
  3. Use I18n.localize with default: [:"time.formats.default"] to enable fallback. ref.

Option 1 is very tedious. Option 3 would likely work, but it introduces unnecessary processing if the initial configuration is already set up, so I’d prefer to avoid it if possible.
What do you think?

@goosys goosys force-pushed the add-administrate_default-format branch from 2995e3d to 6d0935d Compare February 19, 2025 12:56
@nickcharlton nickcharlton added the feature new functionality that’s not yet implemented label Mar 20, 2025
@nickcharlton nickcharlton added this to the Post v1 milestone Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature new functionality that’s not yet implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants