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

Handle Carbon instances in message search criteria #82

Merged
merged 1 commit into from
Apr 14, 2018

Conversation

stephanecoinon
Copy link
Contributor

Allow searching messages using a Carbon instance for the date criteria
(BEFORE, ON, SINCE)

Allow searching messages using a Carbon instance for the date criteria
(BEFORE, ON, SINCE)
@Webklex
Copy link
Owner

Webklex commented Apr 10, 2018

Hi @stephanecoinon ,
thanks for your PR. Seems like a good idea but are you sure you cant search for other Formats like d M y H:i:s or so which are a bit more specific? I'm not realy sure if that's even possible since the specifications are a bit strange... I would like to run some tests before the merge but i'll definetly merge your PR within the next few days.

Thanks again :)

@stephanecoinon
Copy link
Contributor Author

@Webklex OK that's a valid point, I haven't looked at the IMAP spec for dates/times but if you want, you can close this PR and I'll integrate the idea in the fluent API I'm working on:

// Search by date only
$folder->search()->sinceDate(Carbon::parse('1 week ago'))->get();

// Search by date and time
$folder->search()->sinceDateTime(Carbon::parse('1 week ago'))->get();

// Search using a specific format
$folder->search()->since($carbonDateTime->format('d M y H:i:s'))->get();
// or this maybe?
$folder->search()->since($carbonDateTime, 'd M y H:i:s')->get();

@Webklex
Copy link
Owner

Webklex commented Apr 14, 2018

@stephanecoinon I just checked if d M y H:i:s works - it doesn't...

@Webklex Webklex merged commit fba8326 into Webklex:master Apr 14, 2018
@stephanecoinon stephanecoinon deleted the carbon-search branch April 14, 2018 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants