Closed (won't fix)
Project:
Date
Version:
6.x-2.6
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Oct 2009 at 20:09 UTC
Updated:
25 Oct 2018 at 21:29 UTC
Jump to comment: Most recent
PHP 5.2.9
MySQL 5.0.51a
CCK 6.x-2.4
Date 6.x-2.4
Steps to reproduce;
$content['type'] = array (
'name' => 'Annual Report',
'type' => 'annual_report',
'description' => 'An <em>annual report</em> is where CSF\'s Annual Reports can be uploaded.',
'title_label' => 'Title',
'body_label' => 'Blurb about this annual report',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => true,
'sticky' => false,
'revision' => false,
),
'language_content_type' => '0',
'i18n_node' => '1',
'i18nsync_nodeapi' =>
array (
'name' => false,
'status' => false,
'promote' => false,
'moderate' => false,
'sticky' => false,
'revision' => false,
'parent' => false,
'taxonomy' => false,
'comment' => false,
'field_file' => false,
'field_required_image' => true,
'field_year' => true,
),
'old_type' => 'annual_report',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
'content_profile_use' => false,
'comment' => '0',
'comment_default_mode' => '2',
'comment_default_order' => '2',
'comment_default_per_page' => '50',
'comment_controls' => '3',
'comment_anonymous' => '1',
'comment_subject_field' => '1',
'comment_preview' => '1',
'comment_form_location' => '1',
'ant' => '1',
'ant_pattern' => '[field_year-yyyy] Annual Report',
'ant_php' => 0,
'vertical_tabs_fieldsets' =>
array (
'book' => 1,
'revision_information' => true,
'author' => true,
'options' => true,
'menu' => true,
'comment_settings' => true,
'path' => true,
'attachments' => 1,
),
);
$content['fields'] = array (
0 =>
array (
'label' => 'Year',
'field_name' => 'field_year',
'type' => 'date',
'widget_type' => 'date_select',
'change' => 'Change basic information',
'weight' => '-1',
'default_value' => 'now',
'default_value2' => 'same',
'default_value_code' => '',
'default_value_code2' => '',
'input_format' => 'Y-m-d H:i:s',
'input_format_custom' => '',
'year_range' => '-20:+3',
'increment' => '1',
'advanced' =>
array (
'label_position' => 'none',
'text_parts' =>
array (
'year' => 0,
'month' => 0,
'day' => 0,
'hour' => 0,
'minute' => 0,
'second' => 0,
),
),
'label_position' => 'none',
'text_parts' =>
array (
),
'description' => '',
'required' => 1,
'multiple' => '0',
'repeat' => 0,
'todate' => '',
'granularity' =>
array (
'year' => 'year',
),
'default_format' => 'field_year_default',
'tz_handling' => 'none',
'timezone_db' => '',
'op' => 'Save field settings',
'module' => 'date',
'widget_module' => 'date',
'columns' =>
array (
'value' =>
array (
'type' => 'varchar',
'length' => 20,
'not null' => false,
'sortable' => true,
'views' => true,
),
),
'display_settings' =>
array (
'weight' => '-1',
'parent' => '',
'label' =>
array (
'format' => 'hidden',
),
'teaser' =>
array (
'format' => 'hidden',
'exclude' => 0,
),
'full' =>
array (
'format' => 'hidden',
'exclude' => 0,
),
2 =>
array (
'format' => 'field_year_default',
'exclude' => 0,
),
3 =>
array (
'format' => 'hidden',
'exclude' => 0,
),
4 =>
array (
'format' => 'hidden',
'exclude' => 1,
),
'token' =>
array (
'format' => 'field_year_default',
'exclude' => 0,
),
),
),
);
$content['extra'] = array (
'title' => '1',
'body_field' => '0',
'language' => '-4',
'menu' => '2',
);
A simpletest would be useful to avoid regression of this bug.
Comments
Comment #1
BarisW commentedI think I have the same issue. I have a date_field called 'Period' in which users only can add Year entries.
Editing and saving the page changes the year to one year earlier (this happens every time I edit the page).
Using a Diff between the previous revision and the current version shows that the date has been changed from 2006-12-31T23:00:00Z to 2005-12-31T23:00:00Z.
Our site doesn't use User time zone settings, only site-wide time zone settings. Changing this timezone to a positive timezone didn't solve this issue.
Looks like a pretty serious bug to me?
Comment #2
BarisW commentedAny updates? The only workaround for us is to use textfields instead of date entries. Pretty nasty, right?
Comment #3
udig commentedConfirming #1 described behavior.
Using a date field which including only the year portion. Saw at the status report that no default timezone has been set (site wide). Thus selected the relevant timezone (positive). Then on any update to the nodes which hold the date field causing this bug to appear i.e. on the node view shows one year earlier than the year selected at the edit form. Going back to the edit form still shows the right year.
Any idea how to approach this bug? Anyone?
Comment #4
sja1 commented+1 I'm experiencing the same bug. Datefield configured with granularity of just "year", displays one year early. Editing the node shows that the proper year has been stored, so appears to be a display problem.
EDIT: I was experiencing this problem with a field of type "DATESTAMP". I tried creating a new year-only field of type "DATETIME", and this one seems to work. So, perhaps problem is just with DATESTAMP, and a workaround is to use DATETIME instead.
Comment #5
karens commentedThe datestamp field gives you a precision down to the second, which seems pretty silly if you only want to store the year, so the datetime or date fields would make more sense for this use.
There have been lots of fixes to the code since this was reported, don't know if it still applies. I can't reproduce it, even with a datestamp field.
Comment #6
Jerome F commentedSubscribing
I'm experiencing the same problem, I just need to input the year, I did set everything in order to use only "Y" as input and output format. When I submit, I get the selected year -1
I use last 7.x dev
Comment #7
BarisW commentedKaren, did you try to set your own Localization setting on a European setting (eg: Amsterdam)?
Comment #8
Jerome F commentedIn order not to mess up with the 6.x issue I created a new one for 7.x :
http://drupal.org/node/1065606
I described the steps to reproduce there.
Comment #9
damienmckennaUnfortunately the Drupal 6 version of this module is no longer supported.