public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     dm::getResponse()->addJavascript('lib.ui-datepicker');
     if ('en' !== dm::getUser()->getCulture()) {
         dm::getResponse()->addJavascript('lib.ui-i18n');
     }
     dm::getResponse()->addStylesheet('lib.ui-datepicker');
     if ($value && strtotime($value)) {
         // convert value to an array
         $default = array('year' => null, 'month' => null, 'day' => null);
         $value = (string) $value == (string) (int) $value ? (int) $value : strtotime($value);
         if (false === $value) {
             $value = $default;
         } else {
             $value = array('year' => date('Y', $value), 'month' => date('n', $value), 'day' => date('j', $value));
         }
         $formattedValue = strtr($this->getOption('format'), array('%year%' => sprintf('%04d', $value['year']), '%month%' => sprintf('%02d', $value['month']), '%day%' => sprintf('%02d', $value['day'])));
     } else {
         $formattedValue = $value;
     }
     //$formattedValue = dm::getI18n()->getDateForCulture(strtotime($value));
     return $this->renderTag('input', array('name' => $name, 'size' => 10, 'id' => $this->generateId($name), 'class' => 'datepicker_me', 'value' => $formattedValue));
 }