aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_time
Commit message (Collapse)AuthorAgeFilesLines
...
* Add #seconds_until_end_of_day to DateTime and TimeOlek Janiszewski2012-11-291-0/+9
|
* Make caller attribute in deprecation methods optionalAlexey Gaziev2012-10-301-1/+1
|
* update AS/core_ext docs [ci skip]Francesco Rodriguez2012-09-123-32/+41
|
* Expand documentation for change() method in Time, Date, and DateTimeJeff Shantz2012-08-291-2/+7
|
* Improve performance of DateTime#seconds_since_unix_epochAndrew White2012-07-021-2/+5
| | | | | | | | | | | | | | | | | | | 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
* Revert "Use strftime to convert DateTime to numeric"Andrew White2012-07-011-1/+2
| | | | | | | 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.
* Remove DateTime#to_time overrideAndrew White2012-07-011-14/+0
| | | | | | | | 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.
* Use strftime to convert DateTime to numericAndrew White2012-07-011-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* stop `to_s`ing method namesAkira Matsuda2012-06-061-1/+1
| | | | Module#methods are Symbols in Ruby >= 1.9
* removing unnecessary 'examples' noise from activesupportFrancesco Rodriguez2012-05-132-3/+0
|
* added beginning_of_hour support to core_ext calculations for Time and DateTimeMark J. Titorenko2012-05-041-0/+11
|
* String quotes and trailing spacesAlexey Gaziev2012-04-291-1/+1
|
* AS core_ext refactoring pt.2Alexey Gaziev2012-04-292-4/+10
|
* AS core_ext refactoringAlexey Gaziev2012-04-291-12/+21
|
* Deprecate DateTime.local_offsetbrainopia2012-01-252-2/+16
|
* Merge pull request #4524 from nashby/datetime-18-codeJosé Valim2012-01-251-15/+0
|\ | | | | remove ruby 1.8 related code
| * remove ruby 1.8 related codeVasiliy Ermolovich2012-01-181-15/+0
| |
* | Update time zone offset informationbrainopia2012-01-181-1/+1
|/
* revert "fixing some tests on ruby 1.9.3 SHA 33f222b"Vishnu Atrai2012-01-071-23/+0
|
* remove condition since to_time always available in ruby19 DateTimeVishnu Atrai2011-12-311-1/+1
|
* Initial pass at removing dead 1.8.x code from Active Support.José Valim2011-12-202-3/+1
| | | | | | 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.
* Fix punctuation errors.Sebastian Martinez2011-05-041-8/+8
|
* added find_zone and find_zone! to AS timezones and changed the AS Railtie to ↵Josh Kalderimis2011-04-051-1/+1
| | | | | | use find_zone! as well as adding Railtie tests Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* fixing some tests on ruby 1.9.3Aaron Patterson2011-03-071-0/+23
|
* refactored Time#<=> and DateTime#<=> by removing unnecessary calls without ↵Diego Carrion2011-03-041-8/+2
| | | | | | losing performance Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* updated Time, Date and DateTime current methods in AS to use Time.zone and ↵Josh Kalderimis2011-02-281-1/+2
| | | | | | not Time.zone_default. [#6410 state:committed]
* Preserve fractional seconds in DateTime#to_timeJohn Firebaugh2011-02-031-1/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* In AS, only inflector/methods is need in proxy_wrappers.rb, as well as date, ↵Josh Kalderimis2011-01-121-1/+1
| | | | | | 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>
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-142-7/+7
| | | | 's/[ \t]*$//' -i {} \;)
* Refactor move some date, time and date_time methods to */zones and fixed ↵Santiago Pastorino2010-07-033-0/+4
| | | | some requires
* when the timezone is nil, a TimeWithZone object should not be constructed. ↵Aaron Patterson2010-06-171-0/+2
| | | | | | [#4881 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* fix conditions when DateTime#to_date and DateTime#xmlschema methods are definedRaimonds Simanovskis2010-06-041-3/+3
|
* let Time.time_with_datetime_fallback handle properly years in the range 0..138Xavier Noria2010-05-051-0/+6
|
* AS datetime conversions now require AS time conversionssnusnu2010-03-181-0/+1
|
* date_time/calculations.rb needs active_support/core_ext/object/acts_like ↵Xavier Noria2010-01-011-0/+1
| | | | because it uses acts_like?
* Added #to_i to DateTime in ActiveSupport so #to_yaml works correctly on ↵Serguei Filimonov2009-12-151-2/+13
| | | | ActiveRecord models with DateTime attributes.
* Ruby 1.9.2: rational.rb is deprecatedJeremy Kemper2009-11-021-1/+1
|
* Check for date/time methods that moved upstream in 1.9Jeremy Kemper2009-05-071-3/+3
|
* Convert DateTime extensions to class reopensJeremy Kemper2009-03-281-87/+75
|
* Tease out Object#acts_like? behaviorsJeremy Kemper2009-03-281-0/+13
|
* Convert DateTime extension modules to class reopensJeremy Kemper2009-03-262-108/+111
|
* Move Numeric#to_utc_offset_s to TimeZone.seconds_to_utc_offsetJeremy Kemper2009-03-231-1/+1
|
* Merge docrailsPratik Naik2009-01-181-1/+1
|
* Introduce convenience methods past?, today? and future? for Date and Time ↵Clemens Kofler2008-09-141-5/+19
| | | | classes to facilitate Date/Time comparisons.
* Improve documentation coverage and markupXavier Noria2008-05-021-2/+4
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.8.7 compat: detect and alias non-superclass DateTime#to_sJeremy Kemper2008-04-201-4/+9
|
* Add #getutc alias for DateTime#utcgbuesing2008-04-121-0/+1
|
* Improve documentation.Pratik Naik2008-04-051-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9226 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fine, warn. Just don't recurse to death in cc.rbJeremy Kemper2008-03-311-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9161 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Always alias DateTime#to_s to #to_default_sJeremy Kemper2008-03-311-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9155 5ecf4fe2-1ee6-0310-87b1-e25e094e27de