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.
Possibly related to:
Years get a year subtracted on submit
http://drupal.org/node/258688
Installed dev version to remedy years getting subtracted as detailed in the issue above only to find it creates the opposite problem.
Granularity set to Year.
Date field export follows:
$content[type] = array (
'name' => 'Listing',
'type' => 'listing',
'description' => '',
'title_label' => 'MLS #',
'body_label' => '',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => false,
'sticky' => false,
'revision' => false,
),
'nodefamily_max' => '0',
'nodeprofile' => 0,
'comment' => '0',
'old_type' => 'listing',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
'ant' => '0',
'ant_pattern' => '',
'ant_php' => 0,
);
$content[fields] = array (
0 =>
array (
'widget_type' => 'date_text',
'label' => 'date_test',
'weight' => '0',
'default_value' => 'blank',
'default_value_code' => '',
'default_value2' => 'same',
'default_value_code2' => '',
'input_format' => 'Y-m-d H:i:s',
'input_format_custom' => 'Y',
'advanced' =>
array (
'label_position' => 'above',
'text_parts' =>
array (
'year' => 0,
'month' => 0,
'day' => 0,
'hour' => 0,
'minute' => 0,
'second' => 0,
),
),
'increment' => 1,
'year_range' => '-3:+3',
'description' => '',
'group' => false,
'required' => '0',
'multiple' => '0',
'repeat' => 0,
'todate' => '',
'granularity' =>
array (
'year' => true,
0 => 1,
'month' => false,
'day' => false,
'hour' => false,
'minute' => false,
'second' => false,
),
'output_format_date' => 'Y M j',
'output_format_custom' => 'Y',
'output_format_date_long' => 'l, F j, Y - g:ia',
'output_format_custom_long' => '',
'output_format_date_medium' => 'D, m/d/Y - g:ia',
'output_format_custom_medium' => '',
'output_format_date_short' => 'm/d/Y - g:ia',
'output_format_custom_short' => '',
'tz_handling' => 'none',
'timezone_db' => 'UTC',
'field_name' => 'field_date_test',
'field_type' => 'datestamp',
'module' => 'date',
'label_position' => 'above',
'text_parts' =>
array (
),
),
);
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedI just checked in a fix for this to make sure text date fields with year only or year and month only will work right. I think the other types of dates were already fixed, but I'll double-check that, too.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.