Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter nikkel

    (@nikkel)

    Got it. Thanks for your help.
    FWIW, here’s how I edited your plugin:

    	$d1 = strtotime($start_date_full);
    	$d2 = strtotime($end_date_full);
    
    	$inner .= formatDateRange($d1, $d2);
    // Calculate the date range
    function formatDateRange($d1, $d2) {
    	$startThisYear = $startEndYear = '';
    	if (date( 'Y' ) === date('Y', $d1)) {$startThisYear = 1;}
    	if (date( 'Y' ) === date('Y', $d2)) {$endThisYear = 1;}
    	#event starts THIS year
    
        if (date('Y-m-d', $d1) === date('Y-m-d', $d2)) {
            # Same day
            if ($startThisYear === 1) {
    	        return date('M j', $d1);
    	        } else {
    		        return date('M j, Y', $d1);
    	        }
        } elseif (date('Y-m', $d1) === date('Y-m', $d2)) {
            # Same calendar month
            if ($startThisYear === 1) {
    	        return date('M j', $d1) . date(' - j', $d2);
    	        } else {
    		        return date('M j', $d1) . date(' - j, Y', $d2);
    	        }
        } elseif (date('Y', $d1) === date('Y', $d2)) {
            # Same calendar year
            if ($startThisYear === 1) {
    	        return date('M j', $d1) . date(' - M j', $d2);
    	        } else {
    		        return date('M j', $d1) . date(' - M j, Y', $d2);
    	        }
        } else {
            # General case (spans calendar years)
            return date('M j, Y', $d1) . date(' - M j, Y', $d2);
        }
    }
    
    Thread Starter nikkel

    (@nikkel)

    Thanks for this. This gets me close to what I need. I can hide the time using CSS.
    I still need a bit of help with events that span more than one day. If I hide the timerange_separator so I don’t get “AUG 16 -” for single-day events, I end up with “AUG 3, 2018AUG 6, 2018” (NO separator) for multi-day events. Also, as you see in my example, the startdate year shows up in multi-day events where the year is not THIS year. (It formats the date range ‘correctly’ for multi-day events coming up THIS year.)

    (see my example ‘Upcoming Events’ here: https://mhv.psone.ca/

    Thread Starter nikkel

    (@nikkel)

    sorry, but the search field IS working properly — my error. and now as i check some of the pages i believe the ‘old’ 1.9.3 version of datatables.js is not there either! maybe the w3-total-cache plugin was doing too good a job! sorry about that.

    Thread Starter nikkel

    (@nikkel)

    wow! you are amazing! fixed it just like that. i only wish you could do the same for my map plugin! danke sch?n!

    Thread Starter nikkel

    (@nikkel)

    okay. it seems i have to choose between using tablepress OR using wp-google-maps. here’s my page:

    https://roadtrips.koopthereitis.ca/monaco-formula-1/

    there is a ‘map’ tab and a ‘rates’ tab — when i activate your plugin my maps stop working (i’m inserting the map on the first tab [‘overview’] and on the ‘maps’ tab). but the table works! when i deactivate tablepress the map shows up. check the console log and that’s where i see the error.

    thanks for your quick response.

Viewing 5 replies - 1 through 5 (of 5 total)