when trying to implement a custom date formatter to a field, I get the following errors:

Notice: Undefined index: custom_date_format in date_formatter_format() (line 447 of /var/www/drupalvm/drupal/web/sites/all/modules/date/date.module).
Notice: Undefined index: formatted_timezone in theme_date_display_combination() (line 139 of /var/www/drupalvm/drupal/web/sites/all/modules/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 145 of /var/www/drupalvm/drupal/web/sites/all/modules/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 147 of /var/www/drupalvm/drupal/web/sites/all/modules/date/date.theme).

It looks as if this is because the custom formatter field is not saving properly, as when I go to re-edit the feild is blank. Also it shows the message.

Display dates using the default format because the specified format (custom) is not defined
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

roborat created an issue. See original summary.

DeveloperChris’s picture

I can confirm this issue in version 7.54

When saving a custom format for a date display the format is not saved and the date object defaults to the default display format.

DeveloperChris’s picture

FileSize
11.23 KB
9.4 KB
11.98 KB

I have found a workaround to this issue

First create a new date format for example d-M-Y
Add Format

Create a new date type based on your format
Add Type

Use the new date type as the formatter in the content types display options dialogue
Use Date Type

Doesn't solve the original issue but works around it

keha3912’s picture

sub

Arbalest89’s picture

I have the same error. Apache give me the following log that maybe can be inherent to the issue:

PHP Notice: Constant DATE_RFC7231 already defined in /var/www/html/mywebsite/includes/bootstrap.inc on line 258

I've search about it and seems to be that the constant DATE_RFC7231 has been already defined in PHP 7.
I hope it can be useful.

g089h515r806’s picture

I have the same issue.

bensti’s picture

same problem!

Notice : Undefined index: formatted_timezone dans theme_date_display_combination() (ligne 139 dans /sites/all/modules/date/date.theme).

fchandler’s picture

Notice: Undefined index: custom_date_format in date_formatter_format() (line 447 of /var/www/.../public_html/sites/all/modules/date/date.module).
Notice: Undefined index: formatted_timezone in theme_date_display_combination() (line 139 of /var/www/.../public_html/sites/all/modules/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 145 of /var/www/.../public_html/sites/all/modules/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 147 of /var/www/.../public_html/sites/all/modules/date/date.theme).

I think I am in the same boat. Created a time format and attached it to a new date type. Added a date field to a content type, and using the new date type, with the new time format, as the display formatter generates error.
I can use the new time format with the standard date types and it works properly for my content type, but changes other instances that use that date type e.g. admin/content

fchandler’s picture

In my case, I had named the new date type "custom". That is evidently not allowed. I made a new date type with a more descriptive name, applied the format, and it all worked. May be just my experience.

kmonty’s picture

Version: 7.x-2.10 » 7.x-2.x-dev
Priority: Major » Critical

Confirmed this is an issue in the latest -dev release. Escalating this to critical, as this is a pretty significant regression.

kmonty’s picture

Status: Active » Closed (duplicate)

This is the original issue for this, but marking as a duplicate of #2902829: Formatter settings for Custom date type is not getting saved. , as that issue has a patch attached.

woodhous@email.unc.edu’s picture

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.

webmindz’s picture

For me this was the solution:

https://www.drupal.org/project/date/issues/2902829#comment-12224846

Hope this helps you too.

Regards,
Hans

tarzadon’s picture

I'm using Date module 7.x-2.10 with Drupal 7.64. I applied the patch from https://www.drupal.org/project/date/issues/2902829#comment-12224846 but the issue still remains.

Notice: Undefined index: custom_date_format in date_formatter_format() (line 447 of /var/www/html/http/sites/all/modules/date/date.module).
Notice: Undefined index: formatted_timezone in theme_date_display_combination() (line 139 of /var/www/html/http/sites/all/modules/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 145 of /var/www/html/http/sites/all/modules/date/date.theme).
Notice: Undefined index: formatted_time in theme_date_display_combination() (line 147 of /var/www/html/http/sites/all/modules/date/date.theme).

I applied the workaround in #3 for now and that seems to be ok, but would like to see a proper fix.