summaryrefslogtreecommitdiff
path: root/lib/time.rb
AgeCommit message (Collapse)Author
2019-11-21Support %U/%u/%W/%w/%V/%g/%G formats in Time.strptimeJeremy Evans
Most of these formats were documented as supported, but were not actually supported. Document that %g and %G are supported. If %U/%W is specified without yday and mon/mday are not specified, then Date.strptime is used to get the appropriate yday. If cwyear is specifier without the year, or cwday and cweek are specified without mday and mon, then use Date.strptime and convert the resulting value to Time, since Time.make_time cannot handle those conversions Fixes [Bug #9836] Fixes [Bug #14241] Notes: Merged: https://github.com/ruby/ruby/pull/2685
2019-11-06Time#strftime does not support `%Q`Kazuhiro NISHIYAMA
``` % ruby -r date -e 't=Time.utc(2001,2,3,4,5,6,7);p t; p [t, t.to_date, t.to_datetime].map{|d|d.strftime("%Q")}' 2001-02-03 04:05:06.000007 UTC ["%Q", "981158400000", "981173106000"] ```
2019-01-06Fix mday overflownobu
[ruby-core:90897] [Bug #15506] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03Remove `(nanosecond)` too [ci skip]kazu
[Bug #15322] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03time.rb: remove the unsupported formatting options from the document [ci skip]okkez
Time.strptime does not support %3N, %6N, and %9N. close [Bug #15322] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-29Remove unused variable in example code [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-29time.rb: Move documents and stop othersnobu
* lib/time.rb: Move method documents to each methods. And stop documentation of the abstract and others, which were confusingly placed at the top of generated documents prior to the abstract in time.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-09Time.parse based from non-Time objectnobu
* lib/time.rb (Time.make_time): as the document states, the second argument of `Time.parse` may be a non-`Time` object which does not have `getlocal` method, assume it is in the local time in the case. based on the patch by nkmrya (Yasuhiro Nakamura) at [ruby-core:68775]. [ruby-core:68775] [Bug #11037] Co-authored-by: nkmrya (Yasuhiro Nakamura) <yasuhiro6194@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-01[DOC] Add %Q and %+ to strptime [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24time.rb: yday supportnobu
* lib/time.rb (Time.make_time): added yday support. [ruby-core:87545] [Bug #14860] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-28time.rb: fix parsing time zone in iso8601nobu
* lib/time.rb (Time.xmlschema): the minute in time zone designator can be omitted together with the preceding colon. [ruby-core:87277] [Bug #14790] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-28time.rb: fix parsing time zone in iso8601nobu
* lib/time.rb (Time.xmlschema): a colon in time zone designator can be omitted. [ruby-core:87277] [Bug #14790] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28Use Regexp#match? in time.rb for conditionalsnobu
[Fix GH-1852] From: Bart <bartdewater@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-20Make Time.parse respect timezone offset secondsnobu
DateTime.parse handles them correctly, and DateTime.parse.to_time results in the correct time. Time.parse doesn't handle them correctly because Time.zone_offset uses a different regexp that only considers hours and minutes, not seconds. [ruby-core:83400] [Bug #14034] From: Jeremy Evans <code@jeremyevans.net> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05Time.parse's "now" argument as nil works again.akr
* lib/time.rb (make_time): "now" argument as nil works again. This is broken since Ruby 2.2. Mathieu Jobin pointed a problem. https://github.com/ruby/ruby/commit/e4b05d91eb0d48fd172abf015c493bb42d755d07#commitcomment-17421387 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19* lib/time.rb: revert r54167 because it would breaksonots
backward compatibilities, and it is documented that Time.parse does not take into account time zone abbreations other than ones described in RFC 822 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17* lib/time.rb (parse, strptime): Fix Time.parse/strptime does notsonots
have compatibility with DateTime.parse/strptime in terms of parsing timezone [Bug #12190] [Fix GH-1297] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-14* lib/time.rb: Use "<<" to reduce string allocation.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-14* lib/time.rb: Specify frozen_string_literal: true.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-01* lib/time.rb (strptime): Support %s.%N.akr
[ruby-core:68301] [Bug #10904] Patch by Sadayuki Furuhashi. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-01[DOC]akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-27* time.c: [DOC] Clarify %Y in strftime, which can accept any digitszzak
and will output at least 4 digits as the year. Reported by Yury Trofimenko [Bug #8941] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-19Fix `Time.parse` for out of range arguments with an offsetnobu
* lib/time.rb (Time#apply_offset): Guards against a `nil` return value from `Time.month_days` when offsetting date. Out of range values are then caught when `Time.utc` is called (as usual). Previously a `nil` return value from `Time.month_days` would have the `<` operator called on it, and raise `NoMethodError`. [fix GH-667] * lib/rdoc/parser/changelog.rb (RDoc#parse_entries): fix dirty hack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06* lib/time.rb (Time.make_time): Adjust the time zone of "now".akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06* lib/time.rb (Time.make_time): Argument validation code moved fromakr
Time.parse and Time.strptime. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06[DOC] Use EST for previous documentation fix.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06* lib/time.rb (Time.parse): [DOC] Fix an example in the documentation.akr
Reported by Marcus Stollsteimer. [ruby-core:60778] [Bug #9521] and [ruby-core:61718] [Bug #9682] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05* lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptimeakr
doesn't extract date information. Reported by tadayoshi funaba. [ruby-core:62349] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04update a comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04add comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04* lib/time.rb (Time.force_zone!): Use usual local time if it hasakr
expected offset from UTC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04* lib/time.rb (Time.force_zone!): New private method.akr
(Time.make_time): Use Time.force_zone!. (Time.strptime): Ditto. (Time.rfc2822): Ditto. (Time.xmlschema): Ditto. * lib/rss/rss.rb (Time.w3cdtf): Use Time.force_zone!. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03* lib/time.rb (Time.httpdate): Always return a UTC Time object.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03* lib/time.rb (Time.make_time): Refactored.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03* lib/time.rb (Time.rfc2822): Fix year completion.akr
Produce fixed-offset time object if appropriate. (Time.xmlschema): Produce fixed-offset time object if appropriate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03* lib/time.rb (make_time): Produce fixed-offset time object ifakr
appropriate. (Time.strptime): Use d[:zone] instead of d[:offset]. * lib/rss/rss.rb (Time.w3cdtf): Produce fixed-offset time object if appropriate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03* lib/time.rb (Time.strptime): Use d[:offset] if d[:seconds] is notakr
given. Reported by tadayoshi funaba. [ruby-core:62322] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-16* lib/time.rb: [DOC] Fix timezone in example of Time.parse [Bug #9521]zzak
Based on patch by @stomar [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-26* lib/time.rb: [DOC] Fix typoa_matsuda
s/formating/formatting/ [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07* lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns localakr
time Time object as Ruby 2.0 and before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07* lib/time.rb: [DOC] typo in Time.rb overview by @srt32 [Fixes GH-416]zzak
https://github.com/ruby/ruby/pull/416 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-07* lib/time.rb (Time.strptime): Use :offset.akr
Patch by Felipe Contreras. [ruby-core:57694] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-11* lib/time.rb: [DOC] Correcting rdoc visibility of time.rb constantszzak
Reported by Tanaka Akira [ruby-core:56517] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-10* lib/time.rb: [DOC] Document constants by @markijbema [Fixes GH-377]zzak
https://github.com/ruby/ruby/pull/377 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28* lib/time.rb (Time#xmlschema): use strftime specifiers instead ofnobu
fractional exponential calcuation which yields undesirable result. [ruby-core:42997][Bug #6100] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06* lib/time.rb: Clean up Time documentation. Patch by Jake Goulding.drbrain
[Ruby 1.9 - Bug #5416] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06* time.c (Init_Time): Improve Time documentation. Patch by Shanedrbrain
Emmons. [Ruby 1.9 - Bug #5404] * lib/time.rb: Improve time.rb documentation including Time.strptime. Patch by Shane Emmons. [Ruby 1.9 - Bug #5402] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-04* lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.naruse
Reported by Christopher Eberz. [ruby-core:39903] Bug #5399 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-16duplicated statement removed in comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-08 * lib/time.rb (xmlschema): avoid passing any negative numbers.tadf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e