php - Magento 2 grid column filtering by datetime -


in grid have following

     $this->addcolumn('end_date', array(         'header'    => $this->__('end date'),         'align'     => 'right',         'width'     => '150px',         'type'      => 'datetime',         'format'    => \intldateformatter::medium,         'index'     => 'end_date',         'frame_callback' => array($this, 'callbackcolumnendtime')     )); 

it filters datetime value date, ignoring time. in magento datetime filter there method _convertdate magento using filter datetime, calls return parent::_convertdate($date) , filters date, ignoring time, because of $this->getcolumn()->getfiltertime() returning null. question how filter datetime, not date. i'm assuming there option in addcolumn (maybe it'll call setfiltertime($timepart) behind scenes).

    protected function _convertdate($date)     {        if ($this->getcolumn()->getfiltertime()) {            try {                $timezone = $this->getcolumn()->gettimezone() !== false                    ? $this->_localedate->getconfigtimezone() : 'utc';                $admintimezone = new \datetimezone($timezone);                $simpleres = new \datetime($date, $admintimezone);                $simpleres->settimezone(new \datetimezone('utc'));                return $simpleres;            } catch (\exception $e) {                return null;            }        }        return parent::_convertdate($date);     } 


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -