nobu
90048176cc
Make Time.parse respect timezone offset seconds
...
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
2017-10-20 01:03:18 +00:00
akr
5fa7cdbde5
Time.parse's "now" argument as nil works again.
...
* lib/time.rb (make_time): "now" argument as nil works again.
This is broken since Ruby 2.2.
Mathieu Jobin pointed a problem.
e4b05d91eb (commitcomment-17421387)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 14:03:34 +00:00
sonots
64231b49ca
* lib/time.rb: revert r54167 because it would break
...
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-04-19 04:20:48 +00:00
sonots
1ba62fa93a
* lib/time.rb (parse, strptime): Fix Time.parse/strptime does not
...
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
2016-03-17 17:46:22 +00:00
akr
fb2a6ecf9e
* lib/time.rb: Use "<<" to reduce string allocation.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-14 12:45:30 +00:00
akr
fb7ccd690e
* lib/time.rb: Specify frozen_string_literal: true.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-14 08:00:29 +00:00
akr
9ee9812dad
* lib/time.rb (strptime): Support %s.%N.
...
[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-03-01 00:12:48 +00:00
akr
331b0ac55b
[DOC]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-01 15:49:50 +00:00
zzak
ea418dda41
* time.c: [DOC] Clarify %Y in strftime, which can accept any digits
...
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-27 20:58:05 +00:00
nobu
f75b676cc4
Fix `Time.parse` for out of range arguments with an offset
...
* 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-07-19 02:56:39 +00:00
akr
e4b05d91eb
* lib/time.rb (Time.make_time): Adjust the time zone of "now".
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06 09:50:08 +00:00
akr
915ef9ed9b
* lib/time.rb (Time.make_time): Argument validation code moved from
...
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 09:04:09 +00:00
akr
1c3f862f58
[DOC] Use EST for previous documentation fix.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06 08:27:47 +00:00
akr
252afcd9f1
* lib/time.rb (Time.parse): [DOC] Fix an example in the documentation.
...
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-06 08:18:13 +00:00
akr
c2a87a1fa1
* lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptime
...
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-05 02:47:53 +00:00
akr
d9087ffebc
update a comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04 15:57:16 +00:00
akr
0b53b86d47
add comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04 15:51:05 +00:00
akr
fffbcf2867
* lib/time.rb (Time.force_zone!): Use usual local time if it has
...
expected offset from UTC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04 11:52:26 +00:00
akr
a18177d5ed
* lib/time.rb (Time.force_zone!): New private method.
...
(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-04 09:01:19 +00:00
akr
5de24423e6
* lib/time.rb (Time.httpdate): Always return a UTC Time object.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03 18:47:29 +00:00
akr
7a39fcc195
* lib/time.rb (Time.make_time): Refactored.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-03 18:27:21 +00:00
akr
af56a2b6dc
* lib/time.rb (Time.rfc2822): Fix year completion.
...
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 18:11:53 +00:00
akr
c4f29a6576
* lib/time.rb (make_time): Produce fixed-offset time object if
...
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 15:23:29 +00:00
akr
4de238663a
* lib/time.rb (Time.strptime): Use d[:offset] if d[:seconds] is not
...
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-05-03 11:31:33 +00:00
zzak
2be728c45f
* lib/time.rb: [DOC] Fix timezone in example of Time.parse [Bug #9521 ]
...
Based on patch by @stomar [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-16 12:34:34 +00:00
a_matsuda
791ff28628
* lib/time.rb: [DOC] Fix typo
...
s/formating/formatting/
[ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-26 13:17:48 +00:00
akr
a8178c69be
* lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local
...
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 21:00:12 +00:00
zzak
1956ca5d4b
* lib/time.rb: [DOC] typo in Time.rb overview by @srt32 [Fixes GH-416]
...
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 11:32:05 +00:00
akr
da6229a3a0
* lib/time.rb (Time.strptime): Use :offset.
...
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-10-07 11:10:03 +00:00
zzak
2e04bc776c
* lib/time.rb: [DOC] Correcting rdoc visibility of time.rb constants
...
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-11 01:44:42 +00:00
zzak
fe26dc97da
* lib/time.rb: [DOC] Document constants by @markijbema [Fixes GH-377]
...
https://github.com/ruby/ruby/pull/377
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-10 17:44:55 +00:00
nobu
007b7fcdcf
* lib/time.rb (Time#xmlschema): use strftime specifiers instead of
...
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
2012-02-28 08:16:03 +00:00
drbrain
60d83c5da4
* lib/time.rb: Clean up Time documentation. Patch by Jake Goulding.
...
[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 05:59:35 +00:00
drbrain
0d900cecdf
* time.c (Init_Time): Improve Time documentation. Patch by Shane
...
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-06 00:14:55 +00:00
naruse
4eb497d90b
* lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.
...
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-10-04 07:37:11 +00:00
akr
5afbff7bc2
duplicated statement removed in comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-16 01:36:28 +00:00
tadf
0999333732
* lib/time.rb (xmlschema): avoid passing any negative numbers.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-08 10:08:12 +00:00
tadf
03697bc1f3
* lib/time.rb: require 'date'.
...
* ext/date/lib/date/format.rb: removed require line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-24 18:31:47 +00:00
akr
d737ae5449
update comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 10:36:08 +00:00
akr
3f664b30fc
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 14:32:15 +00:00
akr
54370de9f4
* strftime.c: %Y format a year with 4 digits at least.
...
* lib/time.rb: format a year with 4 digits at least.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 11:34:45 +00:00
akr
8dc753f481
update rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-23 17:47:58 +00:00
akr
258ed42c12
* lib/time.rb (Time.parse): use year completion in Date._parse.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-22 10:34:29 +00:00
akr
d9dd33fc27
* lib/time.rb (Time#rfc2822): pad leading zeros for year.
...
(Time#httpdate): ditto.
(Time#xmlschema): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 18:08:47 +00:00
akr
fd9bfef325
* lib/time.rb (Time#xmlschema): use subsec instead of nsec.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 17:11:27 +00:00
akr
16dc9e04cb
* time.c (time_arg): use the year argument as-is. [ruby-dev:38194]
...
* lib/time.rb (Time.parse): interpret small year 0..99 as 1950..2049.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 16:43:15 +00:00
nobu
287a34ae0d
* {ext,lib,test}/**/*.rb: removed trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
akr
d40578e438
rdoc update.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-15 07:18:14 +00:00
akr
1b4c1f715e
* lib/time.rb (Time.parse): raise ArgumentError if Date._parse don't
...
extract date information. [ruby-core:20912]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 22:03:28 +00:00
akr
f343c9d3b7
remove Id keyword.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 12:00:54 +00:00