gmailgem / gmail

A Rubyesque interface to Gmail, with all the tools you'll need.
Other
397 stars 119 forks source link

Gmail stopped supporting full month names #228

Closed peterfication closed 7 years ago

peterfication commented 8 years ago

I encountered the problem today, that Gmail rejected my queries with dates (on, before, after) and after some digging I found the problem in the wrong implementation of the to_imap_date function.

As http://www.ietf.org/rfc/rfc3501.txt states the date format is

...
date = date-text / DQUOTE date-text DQUOE
...
date-text = date-day "-" date-month "-" date-year
...
date-month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" /
                  "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec"
...

The implementation in the gem here uses %B, hence the full month names. However, it should use %b for the short month names.

I can fix this in my project by adding this snippet in my code:

class Object
  def to_imap_date
    date = respond_to?(:utc) ? utc.to_s : to_s
    Date.parse(date).strftime('%d-%b-%Y')
  end
end
yuri-karpovich commented 8 years ago

Works for me. Thank you!

benjiebitium commented 8 years ago

Works for me too. thanks so much

annahiro commented 8 years ago

IT Works ! thank you very much!

evaldasg commented 7 years ago

Thank you! It works!

ruberzen commented 6 years ago

Thanks!