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

Datetime editing does not work for non english #3240

Closed
grillermo opened this issue Jan 14, 2020 · 1 comment
Closed

Datetime editing does not work for non english #3240

grillermo opened this issue Jan 14, 2020 · 1 comment

Comments

@grillermo
Copy link

grillermo commented Jan 14, 2020

I found that momentJS lowercase all strings. You can try on your browser

moment().format("dddd D MMMM YYYY HH:mm")

Or whatever format and that will set all datetime inputs to lower case.

The datetime parser on lib/rails_admin/support/datetime.rb method delocalize asumes all words are titleized. So when that method is called by parse_string it will return the same string, not having delocalized anything so when the DateTime.strptime is called it will receive a string in spanish or whatever and raise ArgumentError returning nil.

I fixed it by editing lib/rails_admin/support/datetime.rb delocalize method adding the titleize method.
image

How should i proceed?

** update **
To avoid having to maintain my own fork of rails admin i just added a js file on the edit action that changes moment to use custom Titleized translations

moment.updateLocale('es', {
  weekdays: 'Domingo_Lunes_Martes_Miércoles_Jueves_Viernes_Sábado'.split('_'),
  months : 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre'.split('_'),
});
@mshibuya
Copy link
Member

mshibuya commented Sep 4, 2021

Closed by 01e8d5f .

@mshibuya mshibuya closed this as completed Sep 4, 2021
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