spatie / calendar-links

Generate add to calendar links for Google, iCal and other calendar systems
https://spatie.be/opensource
MIT License
914 stars 148 forks source link

Fix invalid date range exception argument ordering #116

Closed jason-nabooki closed 3 years ago

jason-nabooki commented 3 years ago

Context and Purposes

When throwing an invalid date range exception the arguments are the wrong way around which results in a misleading exception message.

exception Spatie\CalendarLinks\Exceptions\InvalidLink: TO time (2021-03-12 11:30:00) must be greater than FROM time (2021-03-12 09:30:00)

The signature for InvalidLink exception is

public static function invalidDateRange(DateTimeInterface $to, DateTimeInterface $from): self

alies-dev commented 3 years ago

@jason-nabooki great catch! Unfortunately, this is BC change. On order to ship it now, I created a new method: https://github.com/spatie/calendar-links/commit/863f16557f2b84bcfb9c72eaed901a41114f3acd Thanks for the catch and the idea!