-
Notifications
You must be signed in to change notification settings - Fork 38
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
[UX] Ignored date format of content type #4064
Comments
I think, this issue is related, but not exactly the same. The question is: why does the popup calendar widget add "AM/PM", although neither "a" nor "A" is set in the input format pattern. It seems, date format handling is only correct, if using "H" (24-hour system with leading zero). |
The problem is that date.elements.inc only considers "H" to be a 24-hour format: And if "show24Hours" is not in the widget settings, jquery.timeentry.js (the js library in use) will add am/pm no matter what the pattern is. I'm not sure, if date validation still would work, if we added "G" to set "show24Hours". Anyone willing to dig into this? |
Thanks for the clarification! Unfortunately beyond my skills. |
@indigoxela and @olafgrabienski Thank for the mentions. |
I improved this line: https://github.com/backdrop/backdrop/blob/780e8d8c2bbd2be35e4cd057f279569f49fed93a/core/modules/date/date.elements.inc#L1158 'show24Hours' => (strpos($element['#date_format'], 'H') !== FALSE || strpos($element['#date_format'], 'G') !== FALSE) ? TRUE : FALSE, |
I see an extra dot in your screenshot: 2019.09.19. - at the end of the date. Have you tried without that dot? It works fine here without it. However, it seems, something's wrong with either date object creation in date.class.inc or the way the popup calendar widget handles patterns. To my surprise, there's no |
Forgot to ask: @VasasA do you see these errors only with the date popup widget, or are they the same with select list or textfield input? |
@indigoxela I tested the date format without dot at the end of the date. It works fine, but this dot cannot be omitted in the Hungarian language. |
Input formats are a lot trickier than output formats, as php has to parse it somehow. It seems, the popup calendar library and the timepicker library aren't your friends in this case, either. I'm not sure, if Backdrop can do much for you in this case. Let's hope, someone with a better idea chimes in. |
Description of the bug
When I create a new content type with a new date format, I see an error message when I add a new content : The value input for field Date is invalid: The date "2019.09.17. 05:02PM" does not match the expected format.
Steps To Reproduce
Add new date format without "AM/PM" (Y.m.d. - G:i):
Add new content type with a date field of the new format:
Add new content:
Actual behavior
The time input field ignores the date format, "AM/PM" cannot be deleted, so the value will be invalid.
Expected behavior
The time input field's date format doesn't contain the "AM/PM", allows 24-hour format of an hour without leading zeros.
Additional information
Version: 1.14.0
The text was updated successfully, but these errors were encountered: