Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Apr 23, 2013
  1. @pixeltrix

    Adjust for daylight savings in String#to_time

    pixeltrix authored
    The changes in b79adc4 had a bug where if the time in the String
    was in standard time but the current time was in daylight savings then
    the calculated adjustment was off by an hour.
    
    This commit fixes this and adds extra tests for the following:
    
    * time in string is standard time, current time is standard time
    * time in string is standard time, current time is daylight savings
    * time in string is daylight savings, current time is standard time
    * time in string is daylight savings, current time is daylight savings
    
    Fixes #10306.
Commits on Jan 21, 2013
  1. @pixeltrix

    Use `DateTime.parse` inside `String#to_datetime`

    pixeltrix authored
    Use the standard library's `DateTime.parse` because it's marginally
    faster and supports partial date/time strings.
    
    Benchmark:
           user     system      total        real
    old  3.980000   0.000000   3.980000 (  3.987606)
    new  3.640000   0.010000   3.650000 (  3.641342)
  2. @pixeltrix

    Standardise the return value of `to_time`

    pixeltrix authored
    This commit standardises the return value of `to_time` to an instance
    of `Time` in the local system timezone, matching the Ruby core and
    standard library behavior.
    
    The default form for `String#to_time` has been changed from :utc to
    :local but research seems to suggest the latter is the more common form.
    
    Also fix an edge condition with `String#to_time` where the string has
    a timezone offset in it and the mode is :local. e.g:
    
      # Before:
      >> "2000-01-01 00:00:00 -0500".to_time(:local)
      => 2000-01-01 05:00:00 -0500
    
      # After:
      >> "2000-01-01 00:00:00 -0500".to_time(:local)
      => 2000-01-01 00:00:00 -0500
    
    Closes #2453
Commits on Dec 11, 2012
  1. @pixeltrix

    Deprecate obsolete Time to DateTime fallback methods

    pixeltrix authored
    The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time
    methods were added to handle the limitations of Ruby's native Time
    implementation. Those limitations no longer apply so we are deprecating
    them in 4.0 and they will be removed in 4.1.
Something went wrong with that request. Please try again.