Closed (duplicate)
Project:
Date
Version:
6.x-2.x-dev
Component:
Date CCK Field
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2008 at 21:20 UTC
Updated:
19 Sep 2010 at 12:02 UTC
Jump to comment: Most recent file
Comments
Comment #1
Timo.Kissing commentedI spend about an hour today trying to set a date_popup element to a specific date. After playing around with different formats and values for #default_value, #value and #date_format, I finally looked at the code. I think there is actually a bug with the #default_value, it is never read in date_popup.module - maybe something similar is happening for you.
I finally got date_popup to work (and even accept a timestamp as input for #default_value) after patching the date_popup.module (see attachment). Maybe that will help or at least give you an idea where to look.
The corresponding code in my module that creates the date_popup element is:
$form['options']['mydate'] = array(
'#type' => 'date_popup',
'#default_value' => $node->mydate, // <- unix timestamp
'#title' => t('mydate'),
'#date_type' => DATE_UNIX,
'#date_timezone' => date_default_timezone_name(),
'#date_format' => 'd.m.Y H:i',
'#date_increment' => 15,
'#date_year_range' => '-1:+1',
);
*EDIT*
Sorry, the first "solution" was not really working. It solved one problem, but introduced another.
With the new patch / form element I can now save/display/edit as expected.
Comment #2
karens commentedThis would be a feature request. I'm focusing on fixing bugs now, not adding new features until the bugs are addressed.
Comment #3
arlinsandbulte commentedduplicate of #319195: Set default value to a custom strtotime string (for relative or exact dates)