I have a page type in the admin with a date field. When I enter a date in the admin for example September 8, 1994 it displays correctly in the front end but when i refresh the admin the date displays as Septemeber 8, 1993 one year behind. Any suggestions as to why this is happening?
ArticlePage.php
<?php
class ArticlePage extends Page {
static $db = array(
'Date' => 'Date',
'Time' => 'Time'
);
static $has_one = array('ArticleAuthor' => 'Author');
static $has_many = array('ArticleImages' => 'ArticleImage');
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Date','Article Date (for example: 12/12/2011)'), 'Content');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'MM/dd/YYYY');
$fields->addFieldToTab('Root.Content.Main', $timeField = new TimeField('Time','Article Time (for example: 00:00:00)'), 'Content');
$timeField->setConfig('showdropdown', true);
$articleimages = new ImageDataObjectManager(
$this,
'ArticleImages',
'ArticleImage',
'Image',
array(
'Name' => 'Name',
'Caption' => 'Caption'
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab('Root.Content.ArticleImages', new LiteralField('Article Images Break', '<br />'));
$fields->addFieldToTab('Root.Content.ArticleImages', new LabelField('Article Images Label', 'Article Images'));
$fields->addFieldToTab('Root.Content.ArticleImages', $articleimages);
$author = new HasOneDataObjectManager(
$this,
'ArticleAuthor',
'Author',
array(
'FirstName' => 'FirstName',
'MiddleName' => 'MiddleName',
'LastName' => 'LastName',
'Link' => 'Link'
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab('Root.Content.Author', new LiteralField('Article Author Break', '<br />'));
$fields->addFieldToTab('Root.Content.Author', new LabelField('Article Author', 'Article Author'));
$fields->addFieldToTab('Root.Content.Author', $author);
return $fields;
}
}
class ArticlePage_Controller extends Page_Controller {}
?>