Skip to content

Add missing isNotAllTime() method to DateRange #1173

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

Merged
merged 1 commit into from
Feb 26, 2025

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

@calebporzio calebporzio merged commit 8a519f3 into main Feb 26, 2025
@calebporzio calebporzio deleted the josh/add-missing-is-not-all-time-method branch February 26, 2025 00:14
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
2 participants