7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Date in DOM interface
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 715 Views |
-
Date in DOM interface

23 July 2010 at 5:03am
Hey all,
I've added a datefield to one of my DOM classes and added some configuration:
class NotulenItem extends DataObject {
static $db = array(
'Vergaderdatum' => 'Date'
);function getCMSFields_forPopup() {
$dateField = new DateField('Vergaderdatum');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
$dateField->setLocale('nl_NL');$fields = new FieldSet();
$fields->push($dateField);
return $fields;
}}
This works just about right, when I add a record to my page I see the date in the format I want (dd-mm-yyyy). When I then return to the overview of records that are attached to the page, the date is shown in the default format (yyyy-mm-dd). Is there some way I can influence the format of the Date in the DOM overview?
Cheers!
Barry
-
Re: Date in DOM interface

23 July 2010 at 5:20am
Yup.. just write a custom getter..
public function getNiceDate() {
return $this->obj('YourDatefield')->Format('d-m-Y');
}and then in your fields array, just use "NiceDate" in place of the native date field in the DB.
-
Re: Date in DOM interface

23 July 2010 at 6:34am
Thank you very much for the fast reply, works like a charm
| 715 Views | ||
|
Page:
1
|
Go to Top |

