Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#3 | use_date_type.png | 11.98 KB | DeveloperChris |
#3 | Add_type.png | 9.4 KB | DeveloperChris |
#3 | Add_format.png | 11.23 KB | DeveloperChris |
Comments
Comment #2
DeveloperChris CreditAttribution: DeveloperChris as a volunteer commentedI 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.
Comment #3
DeveloperChris CreditAttribution: DeveloperChris as a volunteer commentedI have found a workaround to this issue
First create a new date format for example d-M-Y
Create a new date type based on your format
Use the new date type as the formatter in the content types display options dialogue
Doesn't solve the original issue but works around it
Comment #4
keha3912 CreditAttribution: keha3912 commentedsub
Comment #5
Arbalest89 CreditAttribution: Arbalest89 commentedI have the same error. Apache give me the following log that maybe can be inherent to the issue:
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.
Comment #6
g089h515r806 CreditAttribution: g089h515r806 commentedI have the same issue.
Comment #7
bensti CreditAttribution: bensti commentedsame problem!
Notice : Undefined index: formatted_timezone dans theme_date_display_combination() (ligne 139 dans /sites/all/modules/date/date.theme).
Comment #8
fchandler CreditAttribution: fchandler as a volunteer commentedNotice: 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
Comment #9
fchandler CreditAttribution: fchandler as a volunteer commentedIn 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.
Comment #10
kmontyConfirmed this is an issue in the latest -dev release. Escalating this to critical, as this is a pretty significant regression.
Comment #11
kmontyThis 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.
Comment #12
woodhous@email.unc.edu CreditAttribution: woodhous@email.unc.edu commentedI'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
webmindz CreditAttribution: webmindz commentedFor me this was the solution:
https://www.drupal.org/project/date/issues/2902829#comment-12224846
Hope this helps you too.
Regards,
Hans
Comment #14
tarzadon CreditAttribution: tarzadon commentedI'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.
I applied the workaround in #3 for now and that seems to be ok, but would like to see a proper fix.