aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time
Commit message (Collapse)AuthorAgeFilesLines
...
* Time includes DateAndTime::Zones acts_like(:time)betesh2014-11-091-0/+1
|
* Time#change can now change nanoseconds (:nsec)Agis-2014-09-141-6/+13
| | | | Closes #16392.
* Time#change throws exception with an out-of-range :usecAgis-2014-09-041-0/+1
| | | | | | | | | | 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.
* [ci skip] builtin -> built-inAkshay Vishnoi2014-04-201-1/+1
|
* Merge pull request #10634 from teleological/time_advance_gregorianAndrew White2014-01-051-4/+6
|\ | | | | Maintain proleptic gregorian in Time#advance
| * Maintain proleptic gregorian in Time#advanceRiley Lynch2013-05-151-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Date#all_week/month/quarter/year for generating date rangesDimko2013-12-031-21/+0
| |
* | Refactor Date, Time, DateTime timezone methodsGilad Zohari2013-08-011-20/+2
| | | | | | | | | | | | 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.
* | Merge pull request #10879 from makaroni4/masterAndrew White2013-07-291-0/+10
|\ \ | | | | | | Added Time#middle_of_day method
| * | Added Time#middle_of_dayAnatoli Makarevich2013-07-281-0/+10
| |/ | | | | | | Added middle_of_day method to Date and DateTime
* | Fix handling of offsets with Time#to_s(:iso8601)Andrew White2013-07-291-1/+2
| | | | | | | | | | | | 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.
* | Add Time#to_s(:iso8601) for easy conversion of times to the iso8601 format ↵David Heinemeier Hansson2013-07-281-1/+2
| | | | | | | | for easy Javascript date parsing
* | Return local time for backwards compatibilityAndrew White2013-07-091-1/+1
| |
* | Retain UTC offset when using Time.at_with_coercionAndrew White2013-07-091-3/+8
| | | | | | | | | | | | | | | | | | | | 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.
* | Fix microsecond precision of Time#at_with_coercionNeer Friedman2013-07-091-1/+1
| | | | | | | | | | | | | | | | 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
* | Removed unsued deprecation requireRashmi Yadav2013-07-041-1/+0
| |
* | Remove deprecated `Time#time_with_datetime_fallback`, `Time#utc_time`Vipul A M2013-07-031-35/+0
| | | | | | | | and `Time#local_time` in favour of `Time#utc` and `Time#local`
* | Override Time.at to work with Time-like valuesAndrew White2013-06-081-0/+12
|/ | | | | | | 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.
* 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.
* Correct comment for (beginning|end)_of_minuteGert Goet2013-02-221-2/+2
|
* Added beginning_of_minute support to core_ext calculations for Time and DateTimeGagan Awhad2013-02-211-0/+15
|
* Revert some warning removals related to Ruby 2.0Carlos Antonio da Silva2013-01-071-2/+0
| | | | | | | | | | | | | | | | | | These warnings were actually a bug in Ruby 2.0, the accessors should not be raising such warnings, they are only meant for ivars. - Revert "fix warnings in Ruby 2.0" This reverts commit 26702a6d3461f4a1c75165030b96886514ecb877. - Revert "Merge pull request #8282 from arunagw/warning_removed_for_ruby2" This reverts commit f63d6544e45e78cda29c0c56fbdf3d9e1f405340, reversing changes made to 3a890681fad8218305585036abed6d7463a44e41.
* Added ability to compare date/time with infinitybUg2013-01-041-0/+5
| | | | | | | | | | | | | | | | | 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-0/+10
| | | | | | | 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.
* Add missing at_end_of_* aliasesAndrew White2012-12-111-0/+2
|
* Use send in Time marshal extensions since the methods are now privateCarlos Antonio da Silva2012-12-031-1/+1
| | | | | | | See https://github.com/ruby/ruby/commit/9c1b3161f20162dc1682d758c0e4d2fc3a74745e All Active Support tests pass in 2.0.0preview2 after this change. Closes #8409
* Add #seconds_until_end_of_day to DateTime and TimeOlek Janiszewski2012-11-291-0/+9
|
* fix warnings in Ruby 2.0Aaron Patterson2012-11-071-0/+2
|
* Hash Syntax changes to 1.9 formatAvnerCohen2012-10-201-1/+1
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-09-213-22/+25
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * update AS/core_ext docs [ci skip]Francesco Rodriguez2012-09-122-15/+15
| |
| * update some AS code examples to 1.9 hash syntax [ci skip]Francesco Rodriguez2012-09-121-7/+10
| |
* | Date.beginning_of_week thread local and beginning_of_week application config ↵gregolsen2012-09-181-2/+3
|/ | | | option added (default is Monday)
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-09-011-2/+7
|\
| * Expand documentation for change() method in Time, Date, and DateTimeJeff Shantz2012-08-291-2/+7
| |
* | Refactored common date and time calculations.Pan Thomakos2012-08-041-198/+3
|/ | | | | | | | * 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.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-07-151-5/+5
|\
| * use 'use_zone' method in example, instead of reimplementing itJakub Kuźma2012-07-101-5/+5
| |
* | adds a missing require [fixes #6896]Xavier Noria2012-07-152-1/+1
|/ | | | | This file uses Time.zone, which is defined in active_support/core_ext/time/zones.rb.
* Make Time#change work with offsets other than UTC or localAndrew White2012-07-011-10/+15
| | | | | Use Time.new to create times where the current offset is not zero or not in the local time zone - closes #4847 and #6651.
* Add missing require.Rhett Sutphin2012-06-251-0/+1
| | | | | | | | 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.
* Add prev_quarter and next_quarter method in Time/Date/DateTimeparanoiase Kang2012-06-201-0/+11
|
* Merge pull request #6376 from jgaskins/timestamp-microsecondsJeremy Kemper2012-05-181-0/+1
|\ | | | | Increase numeric-timestamp precision to nanoseconds
| * Increase `AR#cache_key` precision to nanosecondsJamie Gaskins2012-05-191-0/+1
| |
* | respect nsec in TimeWithZoneVasiliy Ermolovich + Sergey Nartimov2012-05-181-4/+4
|/ | | | | | | | | | | 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 beginning_of_hour support to core_ext calculations for Time and DateTimeMark J. Titorenko2012-05-041-0/+15
|
* String quotes and trailing spacesAlexey Gaziev2012-04-291-6/+6
|
* AS core_ext refactoring pt.2Alexey Gaziev2012-04-291-2/+5
|
* AS core_ext refactoringAlexey Gaziev2012-04-293-32/+101
|
* Remove circular require of time/zonesOscar Del Ben2012-04-211-1/+0
|