Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Apr 22, 2015
  1. @pixeltrix

    Improve ActiveSupport::TimeWithZone conversion to YAML

    pixeltrix authored
    Previously when converting AS::TimeWithZone to YAML it would be output
    as a UTC timestamp. Whilst this preserves the time information accurately
    it loses the timezone information. This commit changes that so that it is
    saved along with the time information. It also provides nicer encoding of
    AS::TimeZone instances themselves which previously embedded all of the
    data from the TZInfo records.
    
    Fixes #9183.
Commits on Mar 9, 2015
  1. @pixeltrix

    Revert "Take DST into account when locating TimeZone from Numeric."

    pixeltrix authored
    Reverting this as it's not the implementation that we would like it to be.
    This is being used inside of ActiveSUpport::TimeZone[] and it's unaware
    of the context in which to find the timezone period so the timezone found
    changes depending on whether DST is in effect for the current period.
    This means that `'2001-01-01'.in_time_zone(-9)` changes from winter/summer
    even though it's the same date that we're trying to convert.
    
    Since finding timezones by numeric offsets is a bit hit and miss we should
    introduce a new API for finding them which supplies the date context in
    which we want to search and we should probably also deprecate the finding
    of timezones via the [] method, though this needs further discussion.
    
    This reverts commit 2cc2fa3.
Commits on Jan 31, 2014
  1. @pixeltrix

    Maintain the current timezone in wrap_with_time_zone

    pixeltrix authored
    Extend the solution from the fix for #12163 to the general case where
    `Time` methods are wrapped with a time zone.
    
    Fixes #12596.
Commits on Jan 26, 2014
  1. @pixeltrix

    Add CHANGELOG entry for #11464

    pixeltrix authored
  2. @pixeltrix

    Maintain current timezone when changing time during DST overlap

    pixeltrix authored
    Currently if a time is changed during DST overlap in the autumn then the
    method `period_for_local` will return the DST period. However if the
    original time is not DST then this can be surprising and is not what is
    generally wanted. This commit changes that behavior to maintain the current
    period if it's in the list of periods returned by `periods_for_local`.
    
    It is possible to alter the behavior of `period_for_local` by specifying a
    second argument but since we may be change from another time that could be
    either DST or not then this would give inconsistent results.
    
    Fixes #12163.
Commits on Jan 5, 2014
  1. @pixeltrix
Commits on Jan 1, 2014
  1. @pixeltrix

    Don't lazy load the tzinfo library

    pixeltrix authored
    Lazy loading the tzinfo library doesn't really buy us anything because
    the gem is installed as a dependency via the gemspec and if a developer
    is using Active Support outside of Rails then they can cherry pick which
    files to load anyway.
    
    Fixes #13553
Commits on Jul 30, 2013
  1. @pixeltrix
Commits on Jul 29, 2013
  1. @pixeltrix

    Fix handling of offsets with Time#to_s(:iso8601)

    pixeltrix authored
    Use a lambda to ensure that the generated string respects the offset of
    the time value. Also add DateTime#to_s(:iso8601) and Date#to_s(:iso8601)
    for completeness.
Commits on Jul 11, 2013
  1. @pixeltrix

    Only raise DelegationError if it's is the source of the exception

    pixeltrix authored
    This fixes situations where nested NoMethodError exceptions are masked
    by delegations. This would cause confusion especially where there was a
    problem in the Rails booting process because of a delegation in the
    routes reloading code.
    
    Fixes #10559
Commits on Jul 9, 2013
  1. @pixeltrix
  2. @pixeltrix

    Retain UTC offset when using Time.at_with_coercion

    pixeltrix authored
    The standard Ruby behavior for Time.at is to return the same type of
    time when passing an instance of Time as a single argument. Since the
    an ActiveSupport::TimeWithZone instance may be a different timezone than
    the system timezone and DateTime just understands offsets the best we
    can do is to return an instance of Time with the correct offset.
    
    Fixes #11350.
Commits on Jun 13, 2013
  1. @pixeltrix

    Keep sub-second resolution when wrapping a DateTime value

    pixeltrix authored
    Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone`
    keeps sub-second resolution when wrapping a `DateTime` value.
    
    Fixes #10855
Commits on Jun 8, 2013
  1. @pixeltrix

    Override Time.at to work with Time-like values

    pixeltrix authored
    Time.at allows passing a single Time argument which is then converted
    to an integer. The conversion code since 1.9.3r429 explicitly checks
    for an instance of Time so we need to override it to allow DateTime
    and ActiveSupport::TimeWithZone values.
Commits on Jan 21, 2013
  1. @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.
  2. @pixeltrix

    Deprecate Date#to_time_in_current_zone

    pixeltrix authored
    The to_time_in_current_zone method doesn't match the naming of the methods
    for converting to ActiveSupport::TimeWithZone on Time and DateTime. Since
    DateTime inherits from Date that has led to confusion with some users
    using the to_time_in_current_zone method with DateTime instances and having
    the time part dropped and the UTC offset lost.
    
    This commit fixes this by deprecating the old method and adding a new
    in_time_zone method which matches the naming for DateTime and Time. This
    should prevent accidently dropping times and UTC offsets when converting
    DateTime instances to ActiveSupport::TimeWithZone.
  3. @pixeltrix

    Add String#in_time_zone method

    pixeltrix authored
    This commit adds a convenience method for converting a string to an
    ActiveSupport::TimeWithZone instance using the configured Time.zone or
    another passed as an argument.
Commits on Dec 1, 2012
  1. @pixeltrix

    Make `Time.zone.parse` to work with JavaScript date strings

    pixeltrix authored
    Chrome, Safari and Firefox serialize Date objects to strings such
    as 'Mon May 28 2012 00:00:00 GMT-0700 (PDT)'. When these strings
    are parsed the zone is interpreted as 'GMT-0700' which doesn't
    exist in the TzInfo list of timezones.
    
    By taking advantage of the improved date/time handling in 1.9.3
    we can use `Date._parse` and the `:offset` value which is parsed
    correctly.
    
    Three tests were amended to make them pass:
    
    1.  test_parse_with_old_date
    
        This needed changing to a different value because the original
        value was before EST was adopted so was being changed to a
        LMT (Local Mean Time) value after the change. It didn't before
        because `DateTime` just has offsets from UTC not timezones.
    
    2.  test_parse_should_not_black_out_system_timezone_dst_jump
    
        Changed the implementation of this test as the stubs were
        dependent on internal implementation details of the test.
        Confirmed that the modified test still failed when the
        implementation of `parse` was restored to pre-#5571.
    
    3.  test_parse_should_black_out_app_timezone_dst_jump
    
        Ditto.
    
    Closes #5770.
Commits on Jul 1, 2012
  1. @pixeltrix

    Make Time#change work with offsets other than UTC or local

    pixeltrix authored
    Use Time.new to create times where the current offset is not zero or
    not in the local time zone - closes #4847 and #6651.
Commits on May 19, 2012
  1. @pixeltrix
Something went wrong with that request. Please try again.