Skip to content

Add "Tomorrow" preset to DateRangePreset enumΒ #2343

@kirgus

Description

@kirgus

Currently, the DateRangePreset enum includes 18 presets covering past dates (Yesterday, Last 7 Days, Last Month, etc.) and present (Today), but there's no built-in preset for "Tomorrow".

This creates an asymmetry in the available options. While past-focused presets are useful for reporting and analytics, scheduling-focused applications often need a quick way to select tomorrow's date.

Use case

In scheduling/booking systems, users frequently need to filter or select appointments for tomorrow. Currently, implementing this requires:

  • Publishing the date-picker view
  • Adding custom JavaScript to handle the preset
  • Manually dispatching events to sync with Livewire
  • Ensuring the correct data format ({start, end} object) is passed to DateRange

This is surprisingly complex for such a common use case.

Proposed solution

Add Tomorrow to the DateRangePreset enum:

case Tomorrow = 'tomorrow';

public function dates(): array
{
    return match ($this) {
        // ...existing cases
        self::Tomorrow => [Carbon::tomorrow(), Carbon::tomorrow()],
    };
}

public function label(): string
{
    return match ($this) {
        // ...existing cases
        self::Tomorrow => __('Tomorrow'),
    };
}

And add the corresponding static method to DateRange:

public static function tomorrow() { 
    return static::fromPreset(DateRangePreset::Tomorrow); 
}

This would allow users to simply add tomorrow to their presets string:

<flux:date-picker presets="today tomorrow yesterday thisWeek" />

Thank you for considering this enhancement!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions