Skip to content

Commit

Permalink
set create time
Browse files Browse the repository at this point in the history
  • Loading branch information
noumo committed May 17, 2015
1 parent e2d08c9 commit 75df30f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion widgets/DateTimePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function registerScript()
$this->options['locale'] = Data::getLocale();
}
$clientOptions = (count($this->options)) ? Json::encode($this->options) : '';
$time = $this->model->{$this->attribute} ? $this->model->{$this->attribute} : time();
$this->getView()->registerJs('
var dtpContainer = $("#'.$this->widgetId.'");
Expand All @@ -53,7 +54,7 @@ public function registerScript()
$("#'.Html::getInputId($this->model, $this->attribute).'").val(e.date.unix());
})
.data("DateTimePicker")
.date(moment('.($this->model->{$this->attribute} * 1000).'));
.date(moment('.($time * 1000).'));
$("[type=text]", dtpContainer).focus(function(e){
dtpContainer.data("DateTimePicker").show();
Expand Down

0 comments on commit 75df30f

Please sign in to comment.