Skip to content
Bladewell
Components
Accordion
Alert
Breadcrumbs
Button
Calendar
Chat
Clock
Command palette
Dropdown
Captcha
Checkbox
Colour picker
Date picker
Date range picker
File upload
Filter builder
Image cropper
Number
OTP
Password
Phone
Radio
Repeater
Search
Select
Show if
Slider
Sortable list
Switch
Tags input
Text input
Textarea
Time picker
Verification code
Field
Icon
Kanban
Auth layout
Sidebar layout
Modal
Pagination
Popover
Price roll
Progress
Stepper
Table
Tabs
Toast
Tooltip
Tooltip cursor
Tree
Docs
Installation
Why Bladewell
For AI agents
Guides
Build a Laravel form from your validation rules
Add a date range picker to a Laravel form
Laravel data table with sorting, filters, pagination
Editable table cells in Laravel with Livewire
A Livewire modal that stays open through re-renders
Using Blade components in Livewire 3 and 4
Two-factor authentication screens for Laravel Fortify
Passkey sign-in for Laravel with Fortify
Real-time notification bell with Laravel Reverb
AI agent actions with Approve and Deny in Laravel
Laravel AI chat with Livewire and streaming replies
Livewire multi-step form with validation per step
Toast notifications in Laravel and Livewire
Livewire file upload with progress and drag and drop
Laravel searchable select that loads from the database
Laravel Blade card, avatar and empty state patterns
Add charts and a rich text editor to a Laravel app
Compare
Bladewell vs Flux: a Free Alternative for Laravel
Bladewell vs Mary UI: daisyUI or Plain Blade
Bladewell vs WireUI: With or Without Alpine
Blade UI Kit Alternative for Laravel 12 and 13
Bladewell vs BladewindUI: Laravel Blade Components
Bladewell vs Sheaf UI: With or Without Alpine
Bladewell vs April UI: Package or Copied-in Code

Guides

Add a date range picker to a Laravel form

A start and end date in one Blade field: matching validation, bookings from today, report periods up to today, and Livewire wire:model.

php artisan bladewell:add date-range-picker

Uses Date range picker. New to Bladewell? Install it first.

One field, two dates

The date range picker is one field with a calendar popover that shows two months side by side (one on a phone). People pick a start, then an end, with the mouse or the arrow keys. It submits two plain Y-m-d values: name="period" sends period[start] and period[end].

resources/views/reports/index.blade.php
<form method="GET" action="{{ route('reports.index') }}" class="flex flex-wrap items-end gap-4">
    <x-widget.date-range-picker name="period" label="Report period" :start="$period['start']" :end="$period['end']" required />
    <x-widget.button type="submit">Show report</x-widget.button>
</form>

By default nothing after today can be picked, which suits reports, leave requests and anything else that already happened. Dates and month names follow your app's locale, and the week starts on the locale's first day. Try it live.

Validate it

Validate each end under its own key, and the end against the start. Messages filed under period, period.start or period.end all show under the one field, with old input filled back in.

app/Http/Requests/ReportRequest.php
namespace App\Http\Requests;

use App\Rules\NotAfterToday;
use Illuminate\Foundation\Http\FormRequest;

class ReportRequest extends FormRequest
{
    public function rules(): array
    {
        // The page first opens with no period, and shows a default one (see below). A period that is sent needs both
        // ends: sometimes on each end would let one through alone, and the view would get half a period. An empty
        // one too, which a JSON body can send: required_with sees nothing to require.
        return [
            'period' => ['sometimes', 'array:start,end', 'required_array_keys:start,end'],
            'period.start' => ['required_with:period', 'date_format:Y-m-d', new NotAfterToday],
            'period.end' => ['required_with:period', 'date_format:Y-m-d', new NotAfterToday, 'after_or_equal:period.start'],
        ];
    }
}

Why NotAfterToday and not before_or_equal:today? The picker's "today" is the visitor's own day, and your server's is usually UTC's. A visitor east of UTC can be a day ahead, so Laravel's rule would reject a genuine today. NotAfterToday compares against the first timezone to reach a new day, so it never does, and still rejects anything in the future. It comes with the picker, copied into app/Rules.

The form sends GET to the page it's on, so the page's first visit has no period yet. That's why period itself is sometimes, with both its keys required, and each end required_with:period: no period at all is fine, but an empty one, a start without an end, or an end without a start, is an error rather than half a period. The controller shows this month until a period is picked, and passes it back so the picker shows what the report covers.

app/Http/Controllers/ReportController.php
namespace App\Http\Controllers;

use App\Http\Requests\ReportRequest;
use Illuminate\View\View;

class ReportController extends Controller
{
    // The form sends GET to this same page, so its first visit has no period yet: show this month until one is picked.
    public function index(ReportRequest $request): View
    {
        $period = $request->validated('period') ?? ['start' => now()->startOfMonth()->toDateString(), 'end' => now()->toDateString()];

        return view('reports.index', ['period' => $period]);
    }
}

Bookings: from today, with no upper limit

For stays, rentals or events, turn the limits around: min="today" and :max="false".

resources/views/bookings/create.blade.php
<x-widget.date-range-picker name="stay" label="Stay" min="today" :max="false" info="Check-in to check-out." required />

Check the same limits on the server, in the Form Request:

In the Form Request's rules()
return [
    // yesterday, not today: see below.
    'stay.start' => ['required', 'date_format:Y-m-d', 'after_or_equal:yesterday'],
    'stay.end' => ['required', 'date_format:Y-m-d', 'after:stay.start'],
];

The same timezone gap applies the other way. A visitor west of your server can still be on yesterday by its clock, so after_or_equal:today would turn down their today. yesterday allows for it. Whether those nights are free is still for your own availability check to decide. after:stay.start asks for at least one night; use after_or_equal where a single day is a valid range.

That's a buffer, not an exact rule: it also accepts yesterday from a visitor whose today has already begun. When every booking belongs to one place, such as a hotel, let its timezone decide instead. Work out its today once, $today = now($hotel->timezone)->toDateString(), and give it to both sides: :min="$today" on the picker, and 'after_or_equal:'.$today in the rules. The picker and the server then agree on the same day.

Your own field names

If your query or model already uses two flat fields, name them with start-name and end-name, and validate from and to directly. :start and :end show a saved range, and take a date object or a Y-m-d string.

A filter form
<x-widget.date-range-picker start-name="from" end-name="to" label="Dates" :start="$filters['from'] ?? null" :end="$filters['to'] ?? null" />

In a Livewire component

Bind it to an array with start and end keys. Both ends update together, in one request with wire:model.live, and a range you set or clear in PHP shows on the next render.

app/Livewire/ReportPeriod.php
namespace App\Livewire;

use App\Rules\NotAfterToday;
use Livewire\Component;

class ReportPeriod extends Component
{
    public array $period = ['start' => null, 'end' => null];

    public function updatedPeriod(): void
    {
        $this->validate([
            'period.start' => ['required', 'date_format:Y-m-d', new NotAfterToday],
            'period.end' => ['required', 'date_format:Y-m-d', new NotAfterToday, 'after_or_equal:period.start'],
        ]);
    }

    public function render()
    {
        return view('livewire.report-period');
    }
}

In the view, bind the picker to that period array with wire:model.live:

resources/views/livewire/report-period.blade.php
<div>
    <x-widget.date-range-picker label="Report period" wire:model.live="period" />
</div>

Only need one date?

The datepicker has the same calendar, limits and keyboard support for a single date, and a birthday mode with a minimum age.