spatie / holidays

Calculate which days you don't have to work!
https://spatie.be/open-source
MIT License
329 stars 196 forks source link

Add getInRange function #150

Closed inDeev closed 4 months ago

inDeev commented 9 months ago

Added function to retrieve all holidays between two dates.

Description from docblock:

    /**
     * getInRange method allows you to pick holidays in a range of dates,
     *   - dates are inclusive.
     *   - dates are swappable, lower date could be passed as second argument.
     *   - dates could be a CarbonInterface or a string.
     *   - acceptable strings formats are 'Y-m-d' or 'Y-m' or 'Y'
     *   - if passed string is 'Y-m' or 'Y' it will be converted to first(from) / last{to} day of the month(from) / year(to)
     * E.g. to retrieve all holidays in between
     *    - 2020-01-01 and 2024-12-31, you could use: getInRange('2020-01-01', '2024-12-31'), getInRange('2020-01', '2024-12') or getInRange('2020', '2024')
     *    - 2024-06-01 and 2025-05-30, you could use: getInRange('2024-06-01', '2025-05-30'), getInRange('2024-06', '2025-05')
     */
Chris53897 commented 4 months ago

@inDeev Thanks for this PR. That was just the function i am missing.

Any chance this is merged in the near future? @Nielsvanpach @freekmurze

Nielsvanpach commented 4 months ago

Thanks!