Custom date formats were allowed in latest 7.x-2.10 release, now, if I goto
Content Type » Manage Display
Now, change date field formatter settings to use custom format type & give a custom format say "d-M-Y".
Click Update & save display settings for content type.
After saving, re-open formatter settings, value for custom_date_format is not getting saved.
When a content is viewed with this setting. Following 2 things happen.
1. Date field is not shown.
2. Following error messages are shown.
Notice: Undefined index: custom_date_format in date_formatter_format() (line 447 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/contrib/date/date.module).
Notice: Undefined index: formatted_timezone in theme_date_display_combination() (line 139 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/contrib/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 145 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/contrib/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 147 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/contrib/date/date.theme).
custom date format were added in this issue : #1504202: Allow entering of custom date format in Views field handlers
Comments
Comment #2
jaykandariComment #3
jaykandariAdded an entry in
hook_field_formatter_info()forcustom_date_formatKindly Review, Thanks!
Comment #4
jaykandariComment #6
nileshlohar commentedVerified patch in #3 and it works well.
Comment #7
tuchoThe patch at #3 worked for me too.
Comment #8
mr.york commentedThank you patch, #3 works for me.
Comment #9
matthiasm11 commentedPatch #3 works for me, D7.56 with Date 7.x-2.10. Settings are saved correctly. (and are exported to features).
Comment #10
damienmckennaComment #11
kmontyMarking #2882574: Notice: Undefined index: custom_date_format in date_formatter_format() as a duplicate, despite being the original issue, as it does not have a patch attached.
Escalating the priority, as this is a significant regression.
Comment #12
woodhous@email.unc.edu commentedThe patch did not fix anything for me.
I'm using Date module 7.x.2.10 and started seeing this . I applied the patch referenced at #2902829: Formatter settings for Custom date type is not getting saved, however it didn't fix the problem.
Notice: Undefined index: formatted_timezone in theme_date_display_combination() (line 139 of /home/docs/public_html/sites/all/modules/date/date.theme).
It is breaking my commerce site. I have products with date fields and line items with date fields. I'm not seeing a problem with saving custom dates.
** NOTE ** I installed date-7.x-2.10+5-dev and the patch and still get the Notice.
Next, I updated commerce and still see the problem.
Comment #13
woodhous@email.unc.edu commentedThe error is in the date.theme file and complaining that the array index does not exist. Here's the code below. The index 'formatted_timezone' is not valid. I only have datepicker (pop-up calendar). It would need a date format, not a timestamp format. The default date format was a timestamp and so I did change it to a date format., thinking that would fix the problem, but it didn't. Either way it gives an error. I'm guessing because the custom field is a calendar popup, and not having anything to do with timestamp.
// Pull the timezone, if any, out of the formatted result and tack it back on
// at the end, if it is in the current formatted date.
$timezone = $dates['value']['formatted_timezone']; <<<<<------ error
if ($timezone) {
$timezone = ' ' . $timezone;
}
Comment #14
woodhous@email.unc.edu commentedUpdate to my reported problem above: commerce product and line item dates
I played around with the Pop-up calendar settings. I changed the date format to be a timestamp format and checked the boxes for hour and minute. When I added it to the shopping cart in this format, I didn't see the errors anymore, however it showed a time along with the date for the pop-up calendar, so I unchecked the hour and minute boxes, but kept the full timestamp format. I did that for both the Product date ranges, as well as the line items for all. So I guess Pop-up calendar is really a date AND time picker and so probably always need a timestamp format. If that is the case, I'm not sure why it lets me select a custom date format, but whatever. I think it is working now. I'll need to monitor the logs to make sure.
Comment #15
charly71 commentedI tried to apply patch but the notice still appears. My problem is exactly like #12 but I'm not able to change the date format to timestamp like explained here https://www.drupal.org/project/date/issues/2902829#comment-12473439 . So the issue for me is still open.
Comment #16
damienmckenna@woodhous: Please open a new issue for that, it doesn't seem to be the same problem as this one.
Comment #18
damienmckennaCommitted. Thank you all.
Comment #20
anrikun commentedAdded child issue #3030575: Formatter settings summary is erroneous when using custom format