Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82036

Validator and Date is not in the expected format

$
0
0

This is simple editor field

 {
                         "label": "Datum vzorčenja",
                         "name": "cert_vzo_par.datum",
                         "type": "datetime",
                         "opts": {
                             "format": "MM.YYYY"
                          }
 }

This is validator

{
        Field::inst('cert_vzo_par.datum')
            ->validator('Validate::dateFormat', 'm.Y')
            ->getFormatter('Format::date_sql_to_format', 'm.Y')
            ->setFormatter('Format::date_format_to_sql', 'm.Y'),
}

Everything works fine, for example, 02.2016, 02.2015, 02.2018, except when we are trying to enter 02.2017. Then the Date is not in the expected format is shown. The only workaround is to remove ->validator('Validate::dateFormat', 'm.Y'). I really don't know what is wrong with this February 2017 (02.2017). I guess it is something wrong with the validator function. I have checked the PHP date formatter and the correct syntax is 'm.Y' Can you help?


Viewing all articles
Browse latest Browse all 82036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>