Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Admin displays date field year 1 year behind


3 Posts   737 Views

Media Contour

Community Member, 33 Posts

18 September 2011 at 9:51am

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?



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(
            'Name' => 'Name',
            'Caption' => 'Caption'
      $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(
            'FirstName' => 'FirstName',
            'MiddleName' => 'MiddleName',
            'LastName' => 'LastName',
            'Link' => 'Link'
      $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 {}



Community Member, 54 Posts

12 July 2012 at 9:23pm


I got the same strange behavior. Did you get this problem solved?


Forum Moderator, 1132 Posts

14 July 2012 at 3:19am

I don't know if this is the same thing but I remember running into something like that once, where it helped using yyyy instead of YYYY. I can still reproduce it - but in my case only for the first of januari :-)