| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Closes #16392.
|
|
|
|
|
|
|
|
|
|
| |
https://github.com/rails/rails/commit/98b46bf5e201307cae56ee14bf41363a539779c5
did not properly handled out-of-range `:usec`s.
Passing a `:usec` that's out of range now throws an `ArgumentError` as it
should.
Fixes #16759.
|
|\
| |
| | |
Maintain proleptic gregorian in Time#advance
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Time#advance uses Time#to_date and Date#advance to calculate a new date.
The Date object returned by Time#to_date is constructed with the assumption
that the Time object represents a proleptic gregorian date, but it is
configured to observe the default julian calendar reform date (2299161j)
for purposes of calculating month, date and year:
Time.new(1582, 10, 4).to_date.to_s # => "1582-09-24"
Time.new(1582, 10, 4).to_date.gregorian.to_s # => "1582-10-04"
This patch ensures that when the intermediate Date object is advanced
to yield a new Date object, that the Time object for return is contructed
with a proleptic gregorian month, date and year.
|
| | |
|
|\ \
| | |
| | | |
Added Time#middle_of_day method
|
| |/
| |
| |
| | |
Added middle_of_day method to Date and DateTime
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
When Time.at_with_coercion (wraps Time.at) is called with a single
argument that "acts_like?(:time)" it is coerced to integer thus losing
it's microsecond percision.
This commits changes this to use `#to_f` to prevent the problem
|
| | |
|
| |
| |
| |
| | |
and `Time#local_time` in favour of `Time#utc` and `Time#local`
|
|/
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
actionmailer/lib/action_mailer/base.rb
activesupport/lib/active_support/configurable.rb
activesupport/lib/active_support/core_ext/module/deprecation.rb
guides/source/action_controller_overview.md
guides/source/active_support_core_extensions.md
guides/source/ajax_on_rails.textile
guides/source/association_basics.textile
guides/source/upgrading_ruby_on_rails.md
While resolving conflicts, I have chosen to ignore changes done in
docrails at some places - these will be most likely 1.9 hash syntax
changes.
|
| | |
|
|/
|
|
| |
option added (default is Monday)
|
|\ |
|
| | |
|
|/
|
|
|
|
|
|
| |
* Added the `DateAndTime::Calculations` module that is included in Time
and Date. It houses common calculations to reduce duplicated code.
* Simplified and cleaned-up the calculation code.
* Removed duplication in tests by adding a behavior module for shared
tests. I also added some missing tests.
|
|
|
|
|
| |
This file uses Time.zone, which is defined in
active_support/core_ext/time/zones.rb.
|
|
|
|
|
| |
Use Time.new to create times where the current offset is not zero or
not in the local time zone - closes #4847 and #6651.
|
|
|
|
|
|
|
|
| |
If you selectively require core_exts (e.g., require
'active_support/core_ext/string'), it is possible for
'active_support/core_ext/time/calculations' to be required when
`ActiveSupport::TimeWithZone` is not available. If this happens, the next call
to Time.=== will fail with a NameError.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
when we pass fractional usec to Time methods we should use Rational
instead of Float because of accuracy problem
Time.local(2011,6,12,23,59,59,999999.999).nsec
# => 999999998
Time.local(2011,6,12,23,59,59,Rational(999999999, 1000)).nsec
# => 999999999
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
Added aliases for prev_year, prev_month, and prev_week in Time and Date calculations
|
| |
| |
| |
| | |
core extensions
|
| |
| |
| | |
[ci skip]
|
|/
|
|
| |
Closes #4883
|
|
|
|
|
|
| |
When day, month or year was passed, advance created a new time
ignoring previous nsec fraction. Now nsec is passed through
usec as a Rational number.
|
| |
|
|
|
|
|
|
|
|
| |
A recent change to beginning_of_week and end_of_week added an argument
that can be used to specify the week's starting day as a symbol. Now
these methods were aliased as monday and sunday respectively which as a
consequence of the argument addition, made calls like obj.monday(:sunday)
possible. This commit makes them methods on their own.
|
| |
|
|
|
|
| |
start based on start day that is monday by default
|
|\
| |
| | |
Fix inconsistencies with Time{WithZone}#{hash,eql?}
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
|
|
|
| |
(example: Event.where(created_at: Time.now.whole_week)) [DHH]
|