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.
Hi.
From everything I've read, I should be able to get a date picker to appear when adding node content, like I could under Drupal 5. I've installed and enabled JQuery UI (6.x-1.2), JQuery update (6.x-1.1) and JQuery plugins (6.x-1.7) under Drupal 6.12, but I just get the plain old text field. I've spent a lot of time Googling, without success, so figured I'd try a support request. I assume it's something I'm doing wrong or expecting that's not implemented.
Regards,
Nigel
Comment | File | Size | Author |
---|---|---|---|
#1 | date.module.patch.txt | 680 bytes | brice-dupe |
Comments
Comment #1
brice-dupe CreditAttribution: brice-dupe commentedNigel,
I was able to get this to work by adding to the Date module's "hook_form_alter". There is NO NEED for jQuery UI and jQuery plugins. Make sure you include the Calendar Popup module that is in the Dates package. Here's what I did specifically:
Edit date/date/date.module
add
to the function date_form_alter() function [@ line 443].
Attached is a patch. You can of course create your own module and hook into alter_form.
Hope this helps!
~ Brice
Comment #2
Nigel CunninghamThanks for the reply and sorry I've been so slow to notice it. I'll give this a try.
Nigel
Comment #3
Nigel CunninghamThat works beautifully!
Thank you very much!
Comment #4
csc4 CreditAttribution: csc4 commentedSorry to reopen this - but could I just clarify...
Is this the official answer?
That the module doesn't support this feature any more and that we should roll a custom patch if we still need this functionality? or is it a bug that the feature has gone away? or is there a setting somewhere which needs changing?
Comment #5
RobLoachStick this in date_popup.module.......
Comment #6
brice-dupe CreditAttribution: brice-dupe commentedI have noticed that this is skewing the hour published. Whenever I use date_popup as the #type of the node_form .... it increments time published by one hour! You can repeat this by saving a node. Edit it and save (without changing anything). The hour will have incremented.
Any ideas?
Comment #7
RobLoachMight be your timezone conversion? Might also be unrelated to this issue.....
Comment #8
brice-dupe CreditAttribution: brice-dupe commentedRob,
Are you able to repeat this?
On my server; timezone is set to American/Kentucky/Monticello. User selectable timezones are disabled.
I have also tried to set Timezone to UTC and it still skews.
The date_popup widget creates two input fields. One to select a date via the calendar popup, and another for the time. The time of day field is quirky. There seems to be some client side code that limits you to typing eoith the hour or second.
Comment #9
seworthi CreditAttribution: seworthi commentedFollowing up on #5 solution, if you also use the "override_node_options" module, you will need to use the following to adjust for that modules 'date' filed changes.
Comment #10
mohanrajthangarasu CreditAttribution: mohanrajthangarasu commentedthat works beautifully. thanks Seworthi
Comment #11
Jax CreditAttribution: Jax commentedsub
Comment #12
Jax CreditAttribution: Jax commentedAfter applying the change in #5 I'm getting the error
warning: mb_strlen() expects parameter 1 to be string, array given in /home/ojacquet/public_html/recticel/includes/unicode.inc on line 407.
because the "Authored on" info is no longer sent as a string but as an array:Comment #13
drupalina CreditAttribution: drupalina commentedI have tried codes in both #1 and #5, but it keeps adding 9 hours (same problem as reported in #6). The server is located in USA, but the site timezone is in GMT+4 (I don't know if this could be one of the problems, but the codes in #1 or #5 seem to skip that which Drupal achieves pretty neatly - i.e. respect the time and timezones).
This is very problematic because very often if an article is added in the evening, then with +9 hours the date of the article will change to the next date. This is a really needed feature because people will be manually adding more than 70,000 nodes from back issues and I just wanted to added some sort of date-popup so as to ease their lives. Can someone help or provide an alternative solution, please? I'm sure this is a very needed feature!
Many-many thanks!
Comment #14
sjz CreditAttribution: sjz commentedI'm experiencing the same problem where the "picker" is not respecting the time zone differential. Too bad to because it would be SO much more user-friendly than the current implementation.
Comment #15
Mac Clemmens CreditAttribution: Mac Clemmens commentedIs there a way to adjust the input from this form element +/- the user's timezone?
Comment #16
drupalina CreditAttribution: drupalina commentedRegarding #6 and #13 I've managed to resolve it by setting up the site timezone in .htaccess file. At the vey begining of it I entered:
SetEnv TZ :Europe/Prague
and now the date popup solution from #5 no longer messes up the time and dates.But in my watchdog logs I still get a PHP ERROR
mb_strlen() expects parameter 1 to be string, array given in /home/example/www/www/includes/unicode.inc on line 404.
Any solutions for this string/array php error???
Comment #17
ianchan CreditAttribution: ianchan commentedsubscribe
Comment #18
CKIDOWsubscribe
Comment #19
skilip CreditAttribution: skilip commentedThe 'mb_strlen' error is caused by the '#maxlength' property. Unset it.
Comment #20
Nigel CunninghamThe patch in #9 works for me without timezone issues or errors in syslog.
Comment #21
grandchamp_g CreditAttribution: grandchamp_g commentedI've tired both #1 and #5 and neither seem to work, it changes the field by making it shorter and allowing only the short date format I have setup as input. But there is no pop-up. Can anyone help me? What am I doing wrong?
Comment #22
barraponto CreditAttribution: barraponto commentedpatches published as a module in http://drupal.org/project/date_popup_authored, but i suppose it is still prone to the same issues reported here...
Comment #23
Mark Trapp@barraponto When I rolled the date_popup_authored module, I did look through the issues here to see if there was things that could be addressed. However, none of these issues are actually caused by the patch/module: #6, #8, and #14 are all related to timezone issues outside the scope of the patch/module, whereas #16 is related to missing one of the lines necessary for the patch. From my testing, if your timezones are properly configured, the patch (and the module) should work just fine.
Comment #24
lee20 CreditAttribution: lee20 commentedsubscribe
Comment #25
Mark TrappI identified the timezone problems you guys have experienced and have fixed this in 6.x-1.0-beta2 of Date Popup Authored (see: #847854: Timezone handling is poor to non-existent.). If you don't want to use the module, here's the modified code:
Comment #26
h2odigital CreditAttribution: h2odigital commentedComment #27
Mark TrappComment #28
klonos...coming from #1562798: Its hard for users to provide valid input in the authoring date field (which is an issue filed against D8 core). There is no action here for more than two years now. Let's see if we can get this moving by assigning it to the latest dev of D7.
Comment #29
barraponto CreditAttribution: barraponto commenteddate is in core. is the picker in core? should we move this issue to core's queue?
Comment #30
klonosWe already have #504524: Extend Authored on field with jQuery UI Date Picker that recently was marked as a duplicate of #1835016: Polyfill date input type.
Comment #31
barraponto CreditAttribution: barraponto commentedAs explained in #30.