-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Summary
When using DateRangeRequiredFilter or DateRangeFilter with configureMondayFirst(true), the date range picker displays Tuesday as the first column in the week grid. If I set configureMondayFirst(false), the first column is Monday as expected.
This suggests an inversion or off-by-one issue in the front-end calendar week-start logic when Monday-first is enabled.
Environment
- Sharp: v9.10.1
- Laravel: v12.32.5
- PHP: constrained by Sharp to 8.3.|8.4. (project runs on PHP 8.4 in our environment)
- Timezone: Europe/Paris (from config/app.php)
- Laravel locale: fr (from config/app.php)
- Carbon: bundled via Laravel ^3.8.4
Note: The behavior was reproduced in multiple browsers; it does not seem browser-specific.
Affected components
- Filters: Code16\Sharp\Filters\DateRangeRequiredFilter, Code16\Sharp\Filters\DateRangeFilter
Minimal configuration that triggers the bug
use Carbon\Carbon;
use Code16\Sharp\Filters\DateRangeRequiredFilter;
use Code16\Sharp\Filters\DateRange\DateRangePreset;
class ExpenseDateFilter extends DateRangeRequiredFilter
{
public function buildFilterConfig(): void
{
$this
->configureLabel('Date')
->configureKey('expense_date')
->configureMondayFirst(true) // problem manifests here
->configureShowPresets(true, [
DateRangePreset::make(Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek(), 'This week'),
DateRangePreset::make(Carbon::now()->subWeek()->startOfWeek(), Carbon::now()->subWeek()->endOfWeek(), 'Last week'),
DateRangePreset::make(Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth(), 'This month'),
]);
}
public function defaultValue(): array
{
return [
'start' => Carbon::now()->startOfWeek(),
'end' => Carbon::now()->endOfWeek(),
];
}
}
Note: In our project we also tested with configureMondayFirst(false)
; with false
, the grid starts on Monday (which is counterintuitive), and with true
it starts on Tuesday.
Steps to reproduce
- Create a
DateRangeRequiredFilter
(orDateRangeFilter
) and callconfigureMondayFirst(true)
. - Set any default or preset range (e.g., current week using
Carbon::now()->startOfWeek()
/endOfWeek()
). - Load the list view with the filter.
- Observe the date range picker grid: the first column is Tuesday, not Monday.
Observed behavior
- With
configureMondayFirst(true)
on filters, the calendar grid starts on Tuesday. - With
configureMondayFirst(false)
, the grid starts on Monday.
This looks like an inversion/misalignment in the Monday-first handling on the front-end.
Metadata
Metadata
Assignees
Labels
No labels