plugins – How change timezone of meta value type date before the query in wordpress

Question

I’ve been trying for days without success. I need change the timezone before the comparision.

The value of meta data:

enter image description here

Mi code:

add_filter('parse_query', 'query_get_eventDay');

function query_get_eventDay($query){

$eventDay = (isset($_GET['eventDay']) && $_GET['eventDay']) ? $_GET['eventDay'] : '';

$args = array(
                    'post_type' => 'eventos',
                    'meta_key' => 'trans_start_time_utc', //I need change the time zone in the value of this meta key, before the comparision
                    'orderby' => 'meta_value_num',
                    'order' => 'ASC',
                    'meta_query' => array(
                        array(
                            'key' => 'trans_start_time_utc',
                            'value' => $eventDay, // I get value in format 2021-07-25 from jquery UI calendar
                            'compare' => 'IN',
                            'type' => 'date'
                        )
                    )
                );

$query->set('meta_query', $args);

}

In the end I get a wrong comparison on the dates 🙁

any help is welcome. Thanks

0
Alejandro Sánchez 1 month 2021-06-20T09:39:36-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse