carbon business days
1.0.0
Dieses Paket zielt darauf ab, die Arbeitstage zwischen zwei Kohlenstoffdaten zu zählen.
$ date = new BusinessDays ();
// Set holidays (2018-1-1 is a Monday)
$ date -> addHoliday (Carbon:: createFromDate ( 2018 , 1 , 1 ));
// Should return 9
$ days = $ date -> daysBetween (
Carbon:: createFromDate ( 2018 , 1 , 1 ),
Carbon:: createFromDate ( 2018 , 1 , 15 )
);
// Set a closed period (whole 2nd week)
$ date -> addClosedPeriod (
Carbon:: createFromDate ( 2018 , 1 , 8 ),
Carbon:: createFromDate ( 2018 , 1 , 12 )
);
// Should return 5
$ days = $ date -> daysBetween (
Carbon:: createFromDate ( 2018 , 1 , 1 ),
Carbon:: createFromDate ( 2018 , 1 , 15 )
);Standard für Wochenendtage sind samstags und sonntags, kann aber konfiguriert werden:
$ date -> setWeekendDays ([Carbon:: SUNDAY , Carbon:: MONDAY ]);Sie können auch Tage ab einem bestimmten Datum hinzufügen oder abziehen:
$ newDate = $ date -> addDaysTo (
Carbon:: createFromDate ( 2018 , 5 , 14 ),
10
);
$ newDate = $ date -> subDaysFrom (
Carbon:: createFromDate ( 2018 , 5 , 14 ),
10
); composer require code16/carbon-business-days
MIT