php-store-hours icon indicating copy to clipboard operation
php-store-hours copied to clipboard

group days with identical hours question

Open ianhaneybeechwood opened this issue 4 years ago • 0 comments

I have just integrated this into my website and it's working perfect, just quick question

Also can the exceptions be date ranges so the opening times for dates 7/4/2020 to 7/31/2020 instead of listing the individual dates, below is the current code

`// REQUIRED // Set your default time zone (listed here: http://php.net/manual/en/timezones.php) date_default_timezone_set('Europe/London'); // Include the store hours class require DIR . '/StoreHours.class.php';

// REQUIRED // Define daily open hours // Must be in 24-hour format, separated by dash // If closed for the day, leave blank (ex. sunday) // If open multiple times in one day, enter time ranges separated by a comma $hours = array( 'mon' => array('09:30 - 18:30'), 'tue' => array('09:30 - 18:30'), 'wed' => array('09:30 - 18:30'), 'thu' => array('09:30 - 18:30'), 'fri' => array('09:30 - 18:30'), 'sat' => array('10:00 - 18:00'), 'sun' => array('10:00 - 18:00') );

// OPTIONAL // Add exceptions (great for holidays etc.) // MUST be in a format month/day[/year] or [year-]month-day // Do not include the year if the exception repeats annually $exceptions = array( '7/04/20' => array('10:00-17:00'), '10/18/20' => array('10:00-17:00') );

$config = array( 'open' => "

Yes, we're open! Today's hours are {%hours%}.

", 'closed' => "

Sorry, we're closed. Today's hours are {%hours%}.

", 'separator' => ' - ', 'join' => ' and ', 'format' => 'g:ia', 'overview_weekdays' => array('Mon ', ' Tue ', ' Wed ', ' Thu ', ' Fri: ', ' Sat ', ' Sun: '), 'hours' => "{%open%} {%separator%} {%closed%}" );`

ianhaneybeechwood avatar Jul 04 '20 11:07 ianhaneybeechwood