Skip to content

Commit 8d4fcf2

Browse files
committed
support one-day input by after & before
when you inputed same day to ‘:after’ & ‘:before’, it treat ‘:on’ inputed.
1 parent d42558d commit 8d4fcf2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/gmail/mailbox.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ def emails(key_or_opts = :all, opts={})
4343
raise ArgumentError, "Couldn't make sense of arguments to #emails - should be an optional hash of options preceded by an optional read-status bit; OR simply an array of parameters to pass directly to the IMAP uid_search call."
4444
end
4545
if !opts.empty?
46+
47+
if opts[:after] === opts[:before]
48+
opts[:on] = opts[:before]
49+
opts[:after] = nil
50+
opts[:before] = nil
51+
end
52+
4653
# Support for several search macros
4754
# :before => Date, :on => Date, :since => Date, :from => String, :to => String
4855
search.concat ['SINCE', opts[:after].to_imap_date] if opts[:after]

0 commit comments

Comments
 (0)