Closed (fixed)
Project:
Date
Version:
7.x-2.5
Component:
Date Field
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2009 at 22:36 UTC
Updated:
25 May 2012 at 04:13 UTC
Jump to comment: Most recent file
Comments
Comment #1
debrajn commentedyou can print like following
format_date($node->created, 'custom', 'D, d M Y h a')
Comment #2
karens commentedI have no idea what this report is saying, either the original report or the reply. Read through the debugging tips on the project page and if you still have problems after that I need an example that I can reproduce, which means telling me exactly how the field is configured, what value you are putting into it, etc.
Comment #3
Mike Wacker commentedAttached is a 20-line module that demonstrates the bug (which I tested this time against version 6.x-2.1). Its pretty easy to read the code and see what it does, but here's the description.
It creates a popup date form item on the node edit form under "Authoring information", and then echoes back the value of that form item when you submit the form. Enter a date and time, and you'll see that the value comes back with the time set to 00:00:00, no matter what you put in as the time.
Comment #4
karens commentedYou left several really really important pieces of information out of this report.
1) You are not using CCK to create a Date popup in the normal manner, you are trying to implement a custom element using the API.
2) You are trying to intervene in the node published date field to use the date popup there.
I originally tried to alter the node published date automatically but found that lots of other modules interfere with that field so that there is no reliable way to add the Date Popup to it and have it work right. And in this case the reason 12 hour time won't work is that Drupal Core is making assumptions about what value is in that field and doing it's own manipulation of the value. If you change your format to use 24 hour time (which is what core expects to be in there) it works fine.
This is not a bug, this is something that may or may not be possible to do with the way that core works now.
Comment #5
Mike Wacker commentedThe inference on 2) was incorrect. I'm not trying to override the node published date field; I was adding another date field under the "Authoring information" fieldset when I originally encountered this bug. I can replicate this bug in any form, not just the node edit form. Here's a modified date_popup_ampm_bug.module which demonstrates this:
Comment #6
karens commentedOK, I can see what you're talking about now. Wow, no one ever gave me a module to do my debugging before. Kind of nice!
I'll see what I can figure out...
Comment #7
karens commentedOK, the problem in your case is you are using a time format that the timepicker widget doesn't support. So you tell the API to expect a date as H:i a but the timepicker is sending a date that looks like H:iA. Since the time is not in the expected format, it can't be interpreted.
This is a limitation of the timepicker and using the API. In the UI I don't let you select a format the timepicker can't use, but I can't keep you from doing that in your custom code.
Someone should add this to the documentation. It is documented in the module code itself, and I guess I assumed anyone writing code might look there. If you have time, you can write a patch to add this to the advanced help documentation.
Comment #9
Umayal commentedhow to save manually AM/PM time format to content.
I already saved manually year,month,day,hour,minute.
(I created the node pro-grammatically)