endOfSecond(), ]; yield [ Period::make('2018-01-01 11:30:15', '2018-01-15 11:30:15', Precision::MINUTE()), Precision::MINUTE(), Carbon::make('2018-01-15 11:30:15')->endOfMinute(), ]; yield [ Period::make('2018-01-01 11:30:15', '2018-01-15 11:30:15', Precision::HOUR()), Precision::HOUR(), Carbon::make('2018-01-15 11:30:15')->endOfHour(), ]; yield [ Period::make('2018-01-01', '2018-01-15', Precision::DAY()), Precision::DAY(), Carbon::make('2018-01-15')->endOfDay(), ]; yield [ Period::make('2018-01-01', '2018-01-15', Precision::MONTH()), Precision::MONTH(), Carbon::make('2018-01-15')->endOfMonth(), ]; yield [ Period::make('2018-01-01', '2018-01-15', Precision::YEAR()), Precision::YEAR(), Carbon::make('2018-01-15')->endOfYear(), ]; // Test defaults to same precision as period yield [ Period::make('2018-01-01', '2018-01-15', Precision::MONTH()), null, Carbon::make('2018-01-15')->endOfMonth(), ]; // Test higher precision yield [ Period::make('2018-01-01', '2018-01-15', Precision::DAY()), Precision::MONTH(), Carbon::make('2018-01-15')->endOfMonth(), ]; // Test exclusive period yield [ Period::make('2018-01-01', '2018-01-15', Precision::DAY(), Boundaries::EXCLUDE_END()), Precision::DAY(), Carbon::make('2018-01-15')->subDay()->endOfDay(), ]; }); dataset('rounding_dates', function () { return [ [Precision::YEAR(), '2018-01-01 00:00:00', '2018-01-01 00:00:00'], [Precision::MONTH(), '2018-02-01 00:00:00', '2018-03-01 00:00:00'], [Precision::DAY(), '2018-02-05 00:00:00', '2018-03-05 00:00:00'], [Precision::HOUR(), '2018-02-05 11:00:00', '2018-03-05 11:00:00'], [Precision::MINUTE(), '2018-02-05 11:11:00', '2018-03-05 11:11:00'], [Precision::SECOND(), '2018-02-05 11:11:11', '2018-03-05 11:11:11'], ]; });