Okay
  Public Ticket #917385
Date format
Closed

Comments

  •  2
    CabrilloFestival started the conversation

    Hi -- date formats prior to 2016 are showing up completely wrong (day/month wrong, and all years as 1900, also wrong). 

    I'm attaching our source spreadsheet. The column we use for dates in the WPDT is "Date General." Date has been formatted as "Text."

    In the past we had a similar problem and were provided with this code workaround, which is no longer working: 

    THIS IS THE MODIFIED VERSION THAT USED TO FIX THE DATE PROBLEM (wp-content/plugins/wpdatatables/source/class.date.wpdatacolumn.php):

    <?php

    /**
     * Class IntColumn is a child column class used
     * to describe columns with float numeric content
     *
     * @author Alexander Gilmanov
     *
     * @since May 2012
     */

    class DateWDTColumn extends WDTColumn {
        
        protected $_jsDataType = 'date';
        protected $_dataType = 'date';
        
        public function __construct( $properties = array () ) {
            parent::__construct( $properties );
            $this->_dataType = 'date';
            
            switch(get_option('wdtDateFormat')){
                case 'd/m/Y':
                case 'd.m.Y':
                case 'd-m-Y':
                case 'd.m.y':
                case 'd-m-y':
                    $this->_jsDataType = 'date-eu';
                    break;
                case 'd-m-Y':
                    $this->_jsDataType = 'date-dd-mmm-yyyy';
                    break;
            }
                    
        }
        
        public function prepareCellOutput( $content ) {
            if(!is_array($content)){
                if( !empty($content) && ( $content != '0000-00-00' ) ){
                    $date = new DateTime($content);
                    $formattedValue = $date->format(get_option('wdtDateFormat'));
                }else{
                    $formattedValue = '';
                }
            }else{
                $date = new DateTime($content);
                $formattedValue = $date->format(get_option('wdtDateFormat'));
            }
            $formattedValue = apply_filters('wpdatatables_filter_date_cell', $formattedValue);
            return $formattedValue;
        }
        
        public function getGoogleChartColumnType(){
            return 'date';
        }
        
    }

    ?>


  • [deleted] replied

    Hi CabrilloFestival,
    Thank you for your purchase

    Is this happening just for "Date General" column or also for other columns that have dates?

  •   CabrilloFestival replied privately
  •  2
    CabrilloFestival replied

    I just attached screenshots, but they looked totally creepy and not what I grabbed! What is going on over there?

  • [deleted] replied

    Hi CabrilloFestival,

    I can't see any screenshot.

    Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check PRIVATE so nobody can see it except us.


  •  2
    CabrilloFestival replied

    I deleted the screenshots as it looked like some sort of spyware was looking at my computer! They were not the screenshots I had captured, but rather other views of my computer's windows and settings. Really creepy. Made me suspicious, and for that reason I am not comfortable providing my login to your company. 

    However, WPDatatables is still the best solution I have found for our needs, so for now we will keep using it. Hopefully that situation was an anomaly, and we can trust WPDT!?

  • [deleted] replied

    Hi CabrilloFestival,

    I don't know what happened but I can guarantee that we are not using any spywares.

    Yes you can trust wpDataTables. I took a look at your Excel file and if the problem with dates is happening just in Date General column just copy and paste Date custom column instead of Date General because they are differently formatted. As I see you are using same dates in both columns.