Skip to content

dansoppelsa/laravel-carbon-macros

Repository files navigation

Laravel Carbon Macros

Packagist Version GitHub Main Workflow Status Packagist License GitHub Contributors

A handy collection of international Illuminate\Support\Carbon date helpers

Available Methods

Multi-National Dates

  • isNewYearsDay
  • isGoodFriday
  • isEasterSunday
  • isAllSaintsDay
  • isChristmasDay
  • isNewYearsEve

US Dates 🇺🇸

  • isMlkJrDay
  • isPresidentsDay
  • isMemorialDay
  • isIndependenceDay
  • isLaborDay
  • isColumbusDay
  • isVeteransDay
  • isAmericanThanksgiving

Canadian Dates 🇨🇦

  • isFamilyDay
  • isVictoriaDay
  • isCanadaDay
  • isCivicHoliday
  • isLabourDay
  • isCanadianThanksgiving
  • isRemembranceDay
  • isBoxingDay

Other Dates

Installation

Install via composer

composer require dansoppelsa/laravel-carbon-macros

Usage

<?php

use Illuminate\Support\Carbon;


$day = Carbon::parse('2020-12-25');

$day->isChristmasDay();
// true

$day->isCanadaDay();
// false

$day->isNewYearsDay();
// false