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.
Just built a webform with a date component and I'm seeing the following errors. Anyone have ideas what I might be doing wrong?
# warning: DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (user) in /webform/components/date.inc on line 527.
# warning: DateTime::__construct() expects parameter 2 to be DateTimeZone, null given in /webform/components/date.inc on line 528.
I'm seeing three of these. I assume it's one for each of the date fields (day, month, year).
Comment | File | Size | Author |
---|---|---|---|
#5 | webform_date_nonconfigurable.patch | 817 bytes | quicksketch |
#5 | webform_date_nonconfigurable7.patch | 681 bytes | quicksketch |
#4 | webform-834838.patch | 834 bytes | realityloop |
Comments
Comment #1
quicksketchDo you have any date-related modules installed? Webform is specifically tailored to work with DateAPI (part of the Date module package), and it should work without DateAPI. If you've got some other date-related module installed, it may be setting the $user->timezone property to something that Webform is not expecting (apparently "user" in this case).
Comment #2
attheshow CreditAttribution: attheshow commentedThe only date related modules I have turned on are:
Date 6.x-2.4
Date API 6.x-2.4
Date Popup 6.x-2.4
Date Timezone 6.x-2.4
Comment #3
realityloopI'm also getting this error, the following date related submodules are active:
Date 6.x-2.x-dev
Date API 6.x-2.x-dev
Date Popup 6.x-2.x-dev
Date Timezone 6.x-2.x-dev
Just before line 518 of date.inc
Just found that the error's go away if I enable user configurable timezones in Date and time settings, so it's not handling defined timezone properly by the look of it.
This can be resolved by changing line 521 to:
I also think line 523 needs to be removed:
I'm not sure its the right fix tho..
Comment #4
realityloopPatch attached
Comment #5
quicksketchThanks realityloop, I have no idea what that "$timezone = NULL" line was doing in there. The check you added isn't quite correct, since we don't want to always blow away the user-timezone. Instead we only want to set the timezone if $timezone == NULL or 'user'. I've committed this patch to both 3.x branches.
Comment #7
arpieb CreditAttribution: arpieb commentedHi there. I'm getting the same errors with the following date-related modules installed and enabled in D6.17:
Calendar 6.x-2.2
Date API 6.x-2.4
Date Popup 6.x-2.4 (configured to use default jQuery date picker)
Date Repeat API 6.x-2.4
Date Timezone 6.x-2.4 (configured for America/New_York, disabled user timezone, first day Sunday)
Webform 6.x-3.0-beta6 (was getting the same error with 6.x-2.9, tried upgrading after reading this thread to get latest patches)
Errors are the following with one date field (popup enabled) and one time field:
If I enable user timezones in 'Date Timezone' the error goes away - maybe that is a clue as to what is still happening?
-R
Comment #8
quicksketchThe problem has already been fixed in CVS but is not included in the beta6 version (which was released June 20). This problem was fixed June 30. You can use the development version of Webform 3.x, or you can wait for the next release.
Comment #9
arpieb CreditAttribution: arpieb commentedGotcha. I guess when I saw:
I (incorrectly) thought the patches had been applied to the dev AND beta branches... Should have paid closer attention to the patch and build dates... Sorry!
For now I'm just going to leave the user timezone setting in place as it's not a real issue at this point. New site, no user accounts yet - and what is one more config option when you create an account anyway? ;)
Thanks for a great module! Keep up the great work!