GithubHelp home page GithubHelp logo

carbon-it-holidays's Introduction

Carbon Support for IT Holidays

This extends Carbon and adds support for several IT holidays.

I start from this repo: https://github.com/geoffreyrose/us-holidays and i customize for italian calendar

Supported Holidays

  • New Years Day
  • Epiphany
  • Easter
  • Easter Monday
  • Liberation Day
  • Labour Day
  • Republic day
  • Assumption of Mary
  • All Saints' Day
  • Immaculate Conception Day
  • Christmas Day
  • St. Stephen's Day

Requirements

Usage

With Composer

$ composer require pizar/carbon-it-holidays
<?php
require 'vendor/autoload.php';

use ITHolidays\Carbon;

Without Composer

<?php
require 'path/to/nesbot/Carbon.php';
require 'path/to/pizar/Carbon.php';

use ITHolidays\Carbon;

Check if date is holiday. Returns boolean

$carbon = new Carbon();
$carbon = Carbon::create(2018, 12, 25);
$carbon->isHoliday(); // bool (true)

Get name if date is holiday. Returns string or false

$carbon = new Carbon();
$carbon = Carbon::create(2018, 12, 31);
$carbon->getHolidayName(); // New Year's Eve

Get date for a specific holiday. Returns string

$carbon = new Carbon();
$carbon = Carbon::create(2018, 1, 1);

$carbon->getNewYearsDayHoliday();                   // 2019-01-01 00:00:00
$carbon->getEpiphanyHoliday();                      // 2019-01-06 00:00:00
$carbon->getEasterMondayHoliday();                  // 2019-04-22 00:00:00
$carbon->getLiberationDayHoliday();                 // 2018-04-25 00:00:00
$carbon->getLabourDayHoliday();                     // 2018-05-01 00:00:00
$carbon->getRepublicDayHoliday();                   // 2018-06-02 00:00:00
$carbon->getAssumptionOfMaryHoliday();              // 2018-08-15 00:00:00
$carbon->getFerragosto();                           // 2018-08-15 00:00:00
$carbon->getAllSaintsDayHoliday();                  // 2018-11-01 00:00:00
$carbon->getImmaculateConceptionDayHoliday();       // 2018-12-08 00:00:00
$carbon->getChristmasDayHoliday();                  // 2018-12-25 00:00:00
$carbon->getStStephenDayHoliday();                  // 2018-12-26 00:00:00

see https://github.com/geoffreyrose/us-holidays for other examples too

carbon-it-holidays's People

Contributors

pizar avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

carbon-it-holidays's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.