DateTimePicker.php
public function run()
    {
        echo ($this->isRange?$this->renderWidgetDateRange():$this->renderWidget()) . "\n";
        
        $containerID = $this->inline ? $this->containerOptions['id'] : $this->options['id'];
        $language = $this->language ? $this->language : Yii::$app->language;
        $language = strtolower( substr($language, 0,2));

        if (strncmp($this->dateFormat, 'php:', 4) === 0) {
            $this->clientOptions['dateFormat'] = FormatConverter::convertDatePhpToJui(substr($this->dateFormat, 4));
        } else {
            $this->clientOptions['dateFormat'] = FormatConverter::convertDateIcuToJui($this->dateFormat, 'date', $language);
        }
		
        if ($language !== 'en-US' && $language !== 'en' && $language !== 'EN' ) {
            $view = $this->getView();
            //$assetBundle = DatePickerLanguageAsset::register($view);
            $assetBundle = DateTimePickerAsset::register($view);
           	$assetBundle->language = $language;
            $options = Json::htmlEncode($this->clientOptions);
            $language = Html::encode($language);
            
            $picker = "date".($this->isDateTime?"time":"")."picker";

            	if (!$this->isRange){
            		$script = "$('#{$containerID}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));";
            		
            	}else {
            		$script = "$('#{$this->from}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));";
            		//$script .= ".on( 'change', function() { $('#{$this->to}').{$picker}( 'option', 'minDate', getDate( this ) );}),";
            		
            		//parsing maxDateTo and minDateTo to clientOptions afterward jsonencode to $options
            		//Util::viewArr( $this->clientOptions);
            		$this->clientOptions['maxDate'] = isset($this->clientOptions['maxDateTo'])?$this->clientOptions['maxDateTo']:'' ;
            		$this->clientOptions['minDate'] =  isset($this->clientOptions['minDateTo'])? $this->clientOptions['minDateTo']:'';
            		$options = Json::htmlEncode($this->clientOptions);
            		
            		$script .= "$('#{$this->to}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));";
            		//$script .= ".on( 'change', function() { $('#{$this->from}').{$picker}( $.extend({}, $.datepicker.regional['{$language}'], $options) );});";
            		
            		$script .= "
            				function getDate( element ) {
						      var date;
						      try {
						        date = $.datepicker.parseDate( dateFormat, element.value );
						      } catch( error ) {
						        date = null;
						      }
						 
						      return date;
						    }";
            	}
	
            $view->registerJs($script);
            	$bundle = $this->getView()->assetManager->getBundle('wattanapong\datetime\DateTimePickerAsset' );
            	$bundle->js[] = ['js/locales/jquery.ui.datepicker-'.$language.'.js'];

            	if ($language == 'th')
            		$bundle->js[] = ['js/locales/jquery.ui.datetimepicker-'.$language.'.js'];
        } else {
            $this->registerClientOptions('datetimepicker', $containerID);
        }

        $this->registerClientEvents('datetimepicker', $containerID);
       
        $bundle = $this->getView()->assetManager->getBundle('yii\jui\JuiAsset' );
        $bundle->css = [
        						'themes/'.$this->theme.'/jquery-ui.css',
        ];
    }
public function run()
    {
        echo ($this->isRange?$this->renderWidgetDateRange():$this->renderWidget()) . "\n";
        
        $containerID = $this->inline ? $this->containerOptions['id'] : $this->options['id'];
        $language = $this->language ? $this->language : Yii::$app->language;
        $language = strtolower( substr($language, 0,2));

        if (strncmp($this->dateFormat, 'php:', 4) === 0) {
            $this->clientOptions['dateFormat'] = FormatConverter::convertDatePhpToJui(substr($this->dateFormat, 4));
        } else {
            $this->clientOptions['dateFormat'] = FormatConverter::convertDateIcuToJui($this->dateFormat, 'date', $language);
        }
		
        if ($language !== 'en-US' && $language !== 'en' && $language !== 'EN' ) {
            $view = $this->getView();
            //$assetBundle = DatePickerLanguageAsset::register($view);
            $assetBundle = DateTimePickerAsset::register($view);
           	$assetBundle->language = $language;
            $options = Json::htmlEncode($this->clientOptions);
            $language = Html::encode($language);
            
            $picker = "date".($this->isDateTime?"time":"")."picker";

            	if (!$this->isRange){
            		$script = "$('#{$containerID}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));";
            		
            	}else {
            		$script = "$('#{$this->from}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));";
            		//$script .= ".on( 'change', function() { $('#{$this->to}').{$picker}( 'option', 'minDate', getDate( this ) );}),";
            		
            		//parsing maxDateTo and minDateTo to clientOptions afterward jsonencode to $options
            		//Util::viewArr( $this->clientOptions);
            		$this->clientOptions['maxDate'] = isset($this->clientOptions['maxDateTo'])?$this->clientOptions['maxDateTo']:'' ;
            		$this->clientOptions['minDate'] =  isset($this->clientOptions['minDateTo'])? $this->clientOptions['minDateTo']:'';
            		$options = Json::htmlEncode($this->clientOptions);
            		
            		$script .= "$('#{$this->to}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));";
            		//$script .= ".on( 'change', function() { $('#{$this->from}').{$picker}( $.extend({}, $.datepicker.regional['{$language}'], $options) );});";
            		
            		$script .= "
            				function getDate( element ) {
						      var date;
						      try {
						        date = $.datepicker.parseDate( dateFormat, element.value );
						      } catch( error ) {
						        date = null;
						      }
						 
						      return date;
						    }";
            	}
	
            $view->registerJs($script);
            	$bundle = $this->getView()->assetManager->getBundle('wattanapong\datetime\DateTimePickerAsset' );
            	$bundle->js[] = ['js/locales/jquery.ui.datepicker-'.$language.'.js'];

            	if ($language == 'th')
            		$bundle->js[] = ['js/locales/jquery.ui.datetimepicker-'.$language.'.js'];
        } else {
            $this->registerClientOptions('datetimepicker', $containerID);
        }

        $this->registerClientEvents('datetimepicker', $containerID);
       
        $bundle = $this->getView()->assetManager->getBundle('yii\jui\JuiAsset' );
        $bundle->css = [
        						'themes/'.$this->theme.'/jquery-ui.css',
        ];
    }
Renders the widget.