<commit_before><?php

namespace worstinme\zoo\elements\datepicker;

use Yii;

class Behavior extends \worstinme\zoo\elements\BaseElementBehavior
{

    public function rules()
    {
        return [
            [$this->attribute,'string'],
            //[$attributes,'required'],
        ];
    }

    public $field = 'value_int';

    public function getValue() {
        $value = parent::getValue();
        return Yii::$app->formatter->asDate($value == null ? time() : $value,'php:d.m.Y');
    }

    public function setValue($value) {
        $date = \DateTime::createFromFormat('d.m.Y',$value);
        if ($date) {
            return parent::setValue($date->getTimestamp());
        }
        return parent::setValue(null);
    }

}<commit_msg>datepicker fixes<commit_after><?php

namespace worstinme\zoo\elements\datepicker;

use Yii;

class Behavior extends \worstinme\zoo\elements\BaseElementBehavior
{

    public function rules()
    {
        return [
            [$this->attribute,'string'],
            //[$attributes,'required'],
        ];
    }

    public $field = 'value_int';

    public function getValue() {
        $value = parent::getValue();
        return Yii::$app->formatter->asDate($value == null ? time() : $value,'php:Y-m-d');
    }

    public function setValue($value) {
        return parent::setValue(strtotime($value));
    }

}
{'fraction_non_alphanumeric': 0.15689149560117302, 'fraction_numerical': 0.0, 'mean_word_length': 2.5826771653543306, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2468523', 'n_tokens_mistral': 413, 'n_tokens_neox': 400, 'n_words': 73}