-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
I ran into this issue trying to solve this Stackoverflow question
problem is
Unable to find source-code formatter for language: rb. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
class Post
include Mongoid::Timestamps
# ... yada yada
end
suppose we have these posts
{"post":"1","created_at": "2014-03-25 13:04:43"} {"post":"2","created_at": "2014-03-25 13:04:44"} {"post":"3","created_at": "2014-03-25 13:04:45"}
i've tried querying the posts using the following
Unable to find source-code formatter for language: rb. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
Post.where(:created_at.gt => "2014-03-25 13:04:44").first.try(:id) #=> 2 #wrong Post.where(:created_at.gt => "2014-03-25 13:04:44 UTC").first.try(:id) #=> 2 #wrong Post.where(:created_at.gt => DateTime.parse("2014-03-25 13:04:44 UTC")).first.try(:id) #=> 2 #wrong Post.where(:created_at.gt => DateTime.parse("2014-03-25 13:04:44 UTC").mongoize).first.try(:id) #=> 2 #wrong Post.where(:created_at.gt => "2014-03-25 13:04:44 UTC".mongoize).first.try(:id) #=> 2 #wrong Post.where(:created_at.lte => "2014-03-25 13:04:43").first.try(:id) #=> nil #wrong Post.where(:created_at.lte => "2014-03-25 13:04:43 UTC").first.try(:id) #=> nil #wrong Post.where(:created_at.gt => second_post.created_at).first.try(:id) #=> 3 #correct
it's really weird , i've tried parsing the string using Date, DateTime and Time but no difference in the result ?