'First', self::Last => 'Last', self::Second => '2nd', self::Third => '3rd', self::Fourth => '4th', self::Fifth => '5th', self::Sixth => '6th', self::Seventh => '7th', self::Eighth => '8th', self::Ninth => '9th', self::Tenth => '10th', self::Eleventh => '11th', self::Twelfth => '12th', self::Thirteenth => '13th', self::Fourteenth => '14th', self::Fifteenth => '15th', self::Sixteenth => '16th', self::Seventeenth => '17th', self::Eighteenth => '18th', self::Nineteenth => '19th', self::Twentieth => '20th', self::TwentyFirst => '21st', self::TwentySecond => '22nd', self::TwentyThird => '23rd', self::TwentyFourth => '24th', self::TwentyFifth => '25th', self::TwentySixth => '26th', self::TwentySeventh => '27th', self::TwentyEighth => '28th', self::TwentyNinth => '29th', self::Thirtieth => '30th', self::ThirtyFirst => '31st', }; } public function isFirst(): bool { return $this === self::First; } public function isLast(): bool { return $this === self::Last; } public function resolveDate(Carbon | CarbonImmutable $date): Carbon | CarbonImmutable { if ($this->isLast()) { return $date->endOfMonth(); } return $date->day(min($this->value, $date->daysInMonth)); } public function mayExceedMonthLength(): bool { return $this->value > 28; } }