-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Date field gets deleted, is detected as datetime #3134
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I wonder if it somehow relates to the fact that every time the admin pages get rendered, they seem to randomly choose between the English and French locales available in the app (no idea how to fix that). Then the value might be rejected because the date format is different between both languages. |
A similar issue exists, could you take a look? Basically, RailsAdmin does not change locale at all. It's your app's responsibility to set it up correctly. |
Thanks, that seems to have been the issue. |
Actually it hasn't. My locale still randomly loads in English/French, and randomly my date values get deleted when saving. So this can stay closed, but because it's a duplicate of #3140. |
This workaround seems to work (use same date format in both locales). # config/locales/rails.en.yml
en:
time:
formats:
long: "%Y-%m-%d %H:%M:%S"
# config/locales/rails.fr.yml
fr:
time:
formats:
long: "%Y-%m-%d %H:%M:%S" |
@sedubois Thank you for the workaround. I think after updating gems I started to get this issue, my date fields were just set to |
Rails admin half of the time displays and allows to select a time, even for fields of type
date
and notdatetime
. This is what it sometimes shows (correct):But just when reloading the page, sometimes it shows this, apparently randomly:
The same display issue applies to the edit page.
But more importantly, when editing the record, randomly the date gets deleted upon saving. So because of this, any time I edit a record, I need to go and check if the date was preserved, otherwise I need to go and enter it again (hoping I remember what the value was).
Using rails_admin 1.4.2 and DB schema:
EDIT: the issue remains (and even gets worse) if the type is set explicitly in the config:
Even in that case the time is shown:
But more importantly, in this case the date field then gets silently nullified every single time when the record is edited.
The text was updated successfully, but these errors were encountered: