cothema / opening-hours
Opening hours component
Installs: 445
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >= 5.5.0
- cothema/time: dev-master
- nette/caching: >=2.3.0
- nette/robot-loader: >=2.3.0
- nette/utils: >=2.3.0
Requires (Dev)
- nette/tester: >=1.6.1
This package is auto-updated.
Last update: 2024-10-29 04:36:31 UTC
README
Installation
Install cothema/opening-hours using Composer:
$ composer require cothema/opening-hours
Example Usage
use Cothema\OpeningHours\Model\OpeningHours; use Cothema\OpeningHours\Status; use Nette\Utils\DateTime; $openingHours = new OpeningHours; $openingHours->setOpeningHours([ '0' => ['10:00', '20:00'], // Sunday '1' => ['22:00', '02:00 +1 day'], // Monday '2' => ['08:00', '24:00'], // Tuesday '3' => ['08:00', '20:00'], // Wednesday '4' => ['10:00', '20:00'], // Thursday '5' => ['00:00', '20:00'], // Friday '6' => ['01:00', '24:00'] // Saturday ]); $openingHours->addSpecificDay('2015-11-15', ['12:00', '16:00']); $openingHours->addSpecificDays(['2015-11-20', '2015-11-25'], ['10:00', '01:00 +1 day']); $openingHours->addSpecificDays(['2015-12-01', '2015-12-02'], FALSE); // Closed all the day $status = new Status($openingHours); $status->setTime(new DateTime('2015-11-30 12:00:00')); // Monday $status->isOpened(); // returns FALSE