Plugin Directory

Changeset 3111688


Ignore:
Timestamp:
07/03/2024 12:34:37 PM (21 months ago)
Author:
myscoot
Message:

Timezone issue fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exly-wp/trunk/public/js/exly-wp-public.js

    r2872239 r3111688  
    287287
    288288})( jQuery );
     289
     290
     291document.addEventListener("DOMContentLoaded", function() {
     292    // Clear all cookies
     293    document.cookie.split(";").forEach(function(c) {
     294        document.cookie = c.trim().split("=")[0] + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
     295    });
     296
     297    // Set the timezone cookie
     298    var timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
     299    document.cookie = "system_timezone=" + timezone + "; path=/";
     300   
     301    // Reload the page after setting the timezone
     302    if (!location.search.includes('reloaded=true')) {
     303        location.href = location.href + '?reloaded=true';
     304    } else {
     305        // Use history.replaceState to remove '?reloaded=true' from the URL
     306        history.replaceState(null, '', location.pathname);
     307    }
     308});
Note: See TracChangeset for help on using the changeset viewer.