| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
https://github.com/ruby/ruby/commit/d781caaf313b8649948c107bba277e5ad7307314
|
|
|
|
|
|
| |
Similar implementations of #in_time_zone exists for Date, Time and DateTime so
method is extracted into its own module. Also some logic is extracted into
private method.
|
|
|
|
|
|
| |
Methods: :past? and :future? are already defined identically
in date_and_time/calculations.rb which is included in Date.
Because DateTime is a subclass of Date, it can call them.
|
|\
| |
| | |
Added Time#middle_of_day method
|
| |
| |
| |
| | |
Added middle_of_day method to Date and DateTime
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
If the DateTime core extensions were loaded before the Date core extensions
then you would get a superclass mismatch as DateTime hasn't been defined
yet so it gets set to Object by the acts_like core extension.
Fixes #11206
|
| | |
|
| | |
|
|/
|
|
|
|
|
| |
Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone`
keeps sub-second resolution when wrapping a `DateTime` value.
Fixes #10855
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
commit 2683de5da85135e8d9fe48593ff6167db9d64b18
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:29:20 2013 -0700
cannot support infinite ranges right now
commit cebb6acef2c3957f975f6db4afd849e535126253
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:26:12 2013 -0700
reverting infinity comparison
commit 385f7e6b4efd1bf9b89e8d607fcb13e5b03737ea
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:23:28 2013 -0700
Revert "Added ability to compare date/time with infinity"
This reverts commit 38f28dca3aa16efd6cc3af6453f2e6b9e9655ec1.
Conflicts:
activesupport/CHANGELOG.md
activesupport/lib/active_support/core_ext/numeric/infinite_comparable.rb
activesupport/test/core_ext/date_ext_test.rb
activesupport/test/core_ext/date_time_ext_test.rb
activesupport/test/core_ext/numeric_ext_test.rb
activesupport/test/core_ext/time_ext_test.rb
activesupport/test/core_ext/time_with_zone_test.rb
commit 0d799a188dc12b18267fc8421675729917610047
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:18:53 2013 -0700
Revert "Refactor infinite comparable definition a bit"
This reverts commit dd3360e05e4909f2f0c74a624cccc2def688f828.
commit 42dec90e49745bbfae546f0560b8783f6b48b074
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date: Fri May 3 11:18:47 2013 -0700
Revert "Require 'active_support/core_ext/module/aliasing' in the infinite_comparable module"
This reverts commit 7003e71c13c53ec3d34250560fbf80b8381df693.
|
|
|
|
| |
DateTime defined in date.rb
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Date, DateTime, Time and TimeWithZone can now be compared to infinity,
so it's now possible to create ranges with one infinite bound and
date/time object as another bound.
Ex.: @range = Range.new(Date.today, Float::INFINITY)
Also it's possible to check inclusion of date/time in range with
conversion.
Ex.: @range.include?(Time.now + 1.year) # => true
@range.include?(DateTime.now + 1.year) # => true
Ability to create date/time ranges with infinite bound is required
for handling postgresql range types.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calculate the seconds since the UNIX epoch using the difference in
Julian day numbers from the epoch date. By reducing the Rational math
to just the offset component this gives a significant improvement.
Benchmark:
Calculating --------------------------------------------
new 27733 i/100ms
current 15031 i/100ms
new 27737 i/100ms
current 15549 i/100ms
--------------------------------------------------------
new 548182.1 (±0.9%) i/s - 2745567 in 5.008943s
current 216380.9 (±1.6%) i/s - 1082232 in 5.002781s
new 510281.9 (±1.2%) i/s - 2551804 in 5.001525s
current 219858.3 (±1.8%) i/s - 1103979 in 5.023039s
|
|
|
|
|
|
|
| |
There appears to be a bug with DateTime#strftime("%s") on 32-bit platforms.
Bug report: http://bugs.ruby-lang.org/issues/6683
This reverts commit 210cd756a628cc19c0d6e44bee8c33dfb2d9d598.
|
|
|
|
|
|
|
|
| |
Currently if the offset is not zero then to_time returns self which
can lead to errors where a developer assumes that the value is a
Time. To solve this we can use the native implementation of
DateTime#to_time in Ruby 1.9.3 as it handles offsets properly and
is faster than our override.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The native implementation of the seconds since the UNIX epoch in
strftime is significantly faster than our method.
Benchmark:
----------
require 'benchmark/ips'
require 'date'
require 'time'
date = DateTime.civil(1253,7,6,20,4,0)
Benchmark.ips do |x|
x.report("strftime.to_i") { date.strftime('%s').to_i }
x.report("ssue.to_i") { ((date - DateTime.civil(1970)) * 86400).to_i }
x.report("strftime.to_f") { date.strftime('%s').to_f }
x.report("ssue.to_f") { ((date - DateTime.civil(1970)) * 86400).to_f }
end
Output:
-------
Calculating -------------------------------------
strftime.to_i 26480 i/100ms
ssue.to_i 13818 i/100ms
strftime.to_f 26561 i/100ms
ssue.to_f 14479 i/100ms
-------------------------------------------------
strftime.to_i 616937.3 (±2.4%) i/s - 3098160 in 5.024749s
ssue.to_i 200108.8 (±6.9%) i/s - 994896 in 4.999278s
strftime.to_f 553581.3 (±2.2%) i/s - 2788905 in 5.040397s
ssue.to_f 204260.3 (±4.3%) i/s - 1028009 in 5.043072s
|
|
|
|
| |
Module#methods are Symbols in Ruby >= 1.9
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
remove ruby 1.8 related code
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
| |
There are a bunch of other implicit branches that adds
1.8.x specific code that still needs to be removed. Pull
requests for those cases are welcome.
|
| |
|
|
|
|
|
|
| |
use find_zone! as well as adding Railtie tests
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
|
| |
|
|
|
|
|
|
| |
losing performance
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
|
|
|
|
|
|
| |
not Time.zone_default.
[#6410 state:committed]
|
|
|
|
| |
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
|
|
|
|
|
|
| |
date_time, and time conversions.rb. This fixes an issue when requiring json and AS saying that i18n is also required.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
|
|
|
|
| |
's/[ \t]*$//' -i {} \;)
|
|
|
|
| |
some requires
|
|
|
|
|
|
| |
[#4881 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
|
| |
|