Plugin Directory

Changeset 3641661


Ignore:
Timestamp:
08/11/2026 09:55:22 AM (3 months ago)
Author:
oscararroliga
Message:

Version 1.2.1 — fix opening-hours timezone bug

Location:
easypeasy-booking/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • easypeasy-booking/trunk/CHANGELOG.md

    r3638139 r3641661  
    55User-facing entries also live in `readme.txt` (WordPress.org requires that
    66format); this file is the developer-facing mirror with more technical detail.
     7
     8## [1.2.1] — 2026-07-24
     9
     10### Fixed
     11- `[epbk_hours]` badge could read "Open now" after actual closing time.
     12  `opening-hours.js`'s `siteNow()` mixed the visitor's own
     13  `Date.prototype.getTimezoneOffset()` into a calculation that already only
     14  needed the site's UTC offset — `Date.now()` is a plain UTC instant,
     15  independent of the visitor's local clock, so adding the visitor's offset
     16  on top was both unnecessary and wrong whenever it didn't happen to cancel
     17  out against the site's own offset. Now: `new Date(Date.now() +
     18  offsetMinutes * 60000)`, read back with the UTC getters.
    719
    820## [1.2.0] — 2026-07-24
  • easypeasy-booking/trunk/assets/js/opening-hours.js

    r3638139 r3641661  
    1818
    1919    // Compute "now" in the *site's* timezone regardless of the visitor's
    20     // browser timezone, using the UTC-offset trick: build a Date whose
    21     // UTC-getters read back the site's local wall-clock time.
     20    // browser timezone. Date.now() is already a plain UTC instant (it does
     21    // not depend on the visitor's local clock/timezone at all), so adding
     22    // the site's UTC offset and reading it back with the UTC-getters gives
     23    // the site's true wall-clock time directly — no need to touch the
     24    // visitor's own getTimezoneOffset() anywhere in this calculation.
    2225    function siteNow(offsetMinutes) {
    23         var utcMs = Date.now() + new Date().getTimezoneOffset() * 60000;
    24         return new Date(utcMs + offsetMinutes * 60000);
     26        return new Date(Date.now() + offsetMinutes * 60000);
    2527    }
    2628
  • easypeasy-booking/trunk/easypeasy-booking.php

    r3638139 r3641661  
    44 * Plugin URI:  https://easypeasybooking.irish/
    55 * Description: A simple, commission-free booking and appointments system for service businesses. Works with or without WooCommerce.
    6  * Version:     1.2.0
     6 * Version:     1.2.1
    77 * Author:      EasyPeasy Booking
    88 * License:     GPL v2 or later
    … …  
    2222
    2323// Plugin constants.
    24 define('EPBK_VERSION', '1.2.0');
     24define('EPBK_VERSION', '1.2.1');
    2525define('EPBK_PLUGIN_FILE', __FILE__);
    2626define('EPBK_PLUGIN_DIR', plugin_dir_path(__FILE__));
  • easypeasy-booking/trunk/readme.txt

    r3638139 r3641661  
    66Tested up to: 7.0
    77Requires PHP: 8.0
    8 Stable tag: 1.2.0
     8Stable tag: 1.2.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    8686== Changelog ==
    8787
     88= 1.2.1 =
     89* Fixed: the [epbk_hours] live badge could show "Open now" past closing time. The client-side clock mixed in the visitor's own browser timezone offset alongside the site's, which only cancelled out correctly by coincidence — now computed from the site's timezone alone.
     90
    8891= 1.2.0 =
    8992* Added a live opening hours widget: the `[epbk_hours]` shortcode and "EasyPeasy Booking — Opening Hours" block show an "Open now / Closed" badge (updates live in the visitor's browser) plus your weekly business hours table.
    … …  
    99102== Upgrade Notice ==
    100103
     104= 1.2.1 =
     105Fixes the [epbk_hours] live badge sometimes showing "Open now" after closing time.
     106
    101107= 1.2.0 =
    102108Adds a live opening hours widget ([epbk_hours] shortcode / Opening Hours block).
Note: See TracChangeset for help on using the changeset viewer.