Created
September 8, 2013 04:43
-
-
Save shuhei/6481898 to your computer and use it in GitHub Desktop.
Active Support's inconsistency in Time-Date comparison.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My local time offset is +0900. | |
require 'date' | |
require 'time' | |
Time.new(2013, 9, 3, 10) > Date.new(2013, 9, 3) # ArgumentError: comparison of Time with Date failed | |
require 'active_support/time' | |
Time.new(2013, 9, 3, 10) > Date.new(2013, 9, 3) # true | |
Time.new(2013, 9, 3, 9) > Date.new(2013, 9, 3) # false | |
Time.new(2013, 9, 3, 9) > Date.new(2013, 9, 3).to_time # true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment