Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing isNotAllTime() method to DateRange #1173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshhanley
Copy link
Member

The problem

We have documented that a isNotAllTime() method exists on the DateRange object, but it doesn't actually exist.

https://fluxui.dev/components/date-picker#all-time

If you are using this date range to filter data, you may want to remove "where" constraints from the query when allTime is selected:

<?php

$orders = Order::when($this->range->isNotAllTime(), function ($query) => {
    $query->whereBetween('created_at', $this->range);
})->get();

The solution

This PR adds it.

public function isNotAllTime(): bool
{
    return $this->preset !== DateRangePreset::AllTime;
}

Fixes #1164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DatePicker - method DateRange::isNotAllTime() doesn't exists
1 participant