aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_ext_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Removed mocha stubbing in active_supportRonak Jangir2015-06-071-14/+19
|
* Extract out with_env_tz helper method.Zuhao Wan2014-06-181-16/+2
| | | | | It’s used at so many places that extracting it out into a helper file is worth doing.
* Added Date#all_week/month/quarter/year for generating date rangesDimko2013-12-031-0/+17
|
* Merge pull request #10879 from makaroni4/masterAndrew White2013-07-291-0/+4
|\ | | | | Added Time#middle_of_day method
| * Added Time#middle_of_dayAnatoli Makarevich2013-07-281-0/+4
| | | | | | | | Added middle_of_day method to Date and DateTime
* | Fix handling of offsets with Time#to_s(:iso8601)Andrew White2013-07-291-0/+1
| | | | | | | | | | | | 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.
* | Remove deprecated `Date#to_time_in_current_zone`Vipul A M2013-07-021-7/+0
|/
* Allow Date to be compared with Time (like it was possible to compare Time ↵David Heinemeier Hansson2013-06-031-0/+4
| | | | with Date)
* Squashed commit of the following:Aaron Patterson2013-05-031-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Standardise the return value of `to_time`Andrew White2013-01-211-2/+6
| | | | | | | | | | | | | | | | | | | | | | 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
* Remove assert_nothing_raisedRafael Mendonça França2013-01-031-4/+2
|
* Added ability to compare date/time with infinitybUg2013-01-041-0/+7
| | | | | | | | | | | | | | | | | 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.
* Deprecate obsolete Time to DateTime fallback methodsAndrew White2012-12-111-1/+1
| | | | | | | 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.
* Deprecate Date#to_time_in_current_zoneAndrew White2012-12-111-0/+8
| | | | | | | | | | | | | 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.
* Refactored common date and time calculations.Pan Thomakos2012-08-041-158/+15
| | | | | | | | * 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.
* Add prev_quarter and next_quarter method in Time/Date/DateTimeparanoiase Kang2012-06-201-0/+12
|
* respect nsec in TimeWithZoneVasiliy Ermolovich + Sergey Nartimov2012-05-181-2/+2
| | | | | | | | | | | 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
* Adding :last_week, :last_month, and :last_year aliases to Time and DateMatt Bridges2012-02-211-0/+24
| | | | core extensions
* use AS::TestCase as the base classAaron Patterson2012-01-051-1/+1
|
* Initial pass at removing dead 1.8.x code from Active Support.José Valim2011-12-201-10/+0
| | | | | | 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.
* add more tests for monday and sunday methodsVijay Dev2011-11-261-0/+2
|
* Tests added for monday and sunday Arun Agrawal2011-11-261-0/+8
| | | | | Reference commits : a8f2860d0e7db86c61bb70935006100b04667ab1 80ac4dc6d0632937ccf61b38bc15fc2f6e27b18b
* Allow a Date to be frozen more than once without an error in Ruby 1.8.xBradley Buda2011-06-081-0/+6
|
* removing stubs. 1.9.3 implements Date.today in C so mocking the return value ↵Aaron Patterson2011-03-071-9/+4
| | | | of Time.now does nothing
* updated Time, Date and DateTime current methods in AS to use Time.zone and ↵Josh Kalderimis2011-02-281-16/+16
| | | | | | not Time.zone_default. [#6410 state:committed]
* Add Date#rfc3339 and Date#iso8601 to ASSantiago Pastorino2011-02-131-0/+10
|
* implements weeks_ago and prev_week for Date/DateTime/Time [#5122 ↵Rob Zolkos & Xavier Noria2010-10-161-0/+16
| | | | state:committed]
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-8/+8
| | | | 's/[ \t]*$//' -i {} \;)
* Date#since, #ago, #beginning_of_day, #end_of_day, #xmlschema return ↵Geoff Buesing2010-06-121-1/+50
| | | | | | TimeWithZone when Time.zone_default is set Signed-off-by: Xavier Noria <fxn@hashref.com>
* oops, two cancelling errors made a previous test pass, fixing itXavier Noria2010-06-071-1/+1
|
* the order in which we apply deltas in Date#advance matters, add test ↵Xavier Noria2010-06-071-0/+10
| | | | coverage for that
* removes deprecations of last_(month|year) from master, they will be ↵Xavier Noria2010-05-191-8/+0
| | | | deprecated in 2.3 instead
* defines prev_(month|year) in Date and Time to ease transition to 1.9, and ↵Xavier Noria2010-05-121-9/+17
| | | | deprecates last_(month|year)
* adds calendar reform test coverage for more relevant date calculationsXavier Noria2010-05-091-1/+14
|
* Backports Date#>> from 1.9 so that calculations do the right thing around ↵Xavier Noria2010-05-091-0/+27
| | | | | | | | | | the calendar reform Our next_month gives November for some late dates in September of 1582. Related methods, last_*, and in general advance have the same issues. This commit fixes those, see the test suite for expected behavior, which we still run in 1.9 to ensure it matches as we do with other methods defined in Date in 1.9.
* add test coverage for (last|next)_year on leap yearsXavier Noria2010-05-081-0/+8
|
* let Time.time_with_datetime_fallback handle properly years in the range 0..138Xavier Noria2010-05-051-1/+7
|
* adds test coverage for Date.current vs Date.today in ↵Xavier Noria2010-05-031-1/+45
| | | | Date.(yesterday|tomorrow) implementation
* revises tests for Date.yesterday and Date.tomorrowXavier Noria2010-05-021-3/+3
|
* Consolidate date & time landscape: require 'active_support/time'Jeremy Kemper2009-11-141-1/+1
|
* Duplicating the options hash in Date#advance to prevent modification of the ↵Jay Pignata2009-08-311-0/+6
| | | | | | original [#1133 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Setting usec (and nsec for Ruby 1.9) on Time#end_of_* methods [#1255 ↵Hugo Peixoto2009-08-091-1/+1
| | | | | | status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Explicit test dependenciesJeremy Kemper2009-03-291-0/+1
|
* Remove obsolete silence_warnings wrappers from TZInfo-dependent tests in ↵Levin Alexander2009-02-141-7/+5
| | | | ActiveSupport [#1914 state:resolved]
* Require mocha >= 0.9.0 for AS testsJeremy Kemper2008-11-221-36/+32
|
* Add thorough tests for Time-object #past?, #future? and #today. Fix ↵gbuesing2008-09-141-11/+19
| | | | TimeWithZone #today? to use #time instead of #utc for date comparison. Update changelog. [#720 state:resolved]
* Introduce convenience methods past?, today? and future? for Date and Time ↵Clemens Kofler2008-09-141-0/+15
| | | | classes to facilitate Date/Time comparisons.
* Work around frozen Date memoizationJeremy Kemper2008-08-251-4/+12
|
* Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ↵Joshua Peek2008-06-031-7/+7
| | | | ActiveSupport [#238 state:resolved]
* Added tests [#279 state:resolved] (Nicholas Schlueter)David Heinemeier Hansson2008-06-021-0/+4
|