GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - wearebraid/carbon-availability: A Carbon utility useful for sorting out availability and producing calendly-like results.

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
composer.lock
composer.lock
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

CarbonAvailability

Build Status

Given some available times and some unavailable times how do you determine what time slots you can schedule an event of a certain duration (think something like calendly)? Well – it's surprisingly hard – unless you're using this.

use Braid\CarbonAvailability;

/**
 * [==========]                            | Available time blocks
 *               [========]                |
 *                        [==========]     | ______________________
 *                    [xxxxxxx]            | Booked time blocks
 *                                [x]      | ______________________
 * [==========] [====]         [=]         | Merged availability
 * |  |  |  |   |  |           |           | Available sessions
 */

$availability = [
    ['2019-01-01 09:00:00', '2019-01-01 10:00:00'],
    ['2019-01-01 10:15:00', '2019-01-01 11:00:00'],
    ['2019-01-01 11:00:00', '2019-01-01 12:00:00']
];

$booked = [
    ['2019-01-01 10:45:00', '2019-01-01 11:30:00'],
    ['2019-01-01 11:50:00', '2019-01-01 11:55:00']
];

$availability = new CarbonAvailability($availability, $booked);
$startTimes = $availability->session('15 minutes');
/* Returns the following Carbon\Carbon date times (2019-01-01):
09:00
09:15
09:30
09:45
10:15
10:30
11:30
*/

Installation

composer require wearebraid/carbon-availability

About

A Carbon utility useful for sorting out availability and producing calendly-like results.

Resources

Readme
MIT license
Activity
Custom properties

Stars

4 stars

Watchers

3 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.