122 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
ad773b5e99 [ruby/time] [DOC] Make RDoc coverage 100%
https://github.com/ruby/time/commit/c668704413
2024-11-29 01:39:01 +00:00
Hiroshi SHIBATA
7c9cda9b52 [ruby/time] Bump up v0.4.1
https://github.com/ruby/time/commit/539b151049
2024-11-08 05:00:24 +00:00
Nobuyoshi Nakada
047a7750d1 [ruby/time] [DOC] Escape the word "Date" that does not mean Date class
https://github.com/ruby/time/commit/933eccf8d9
2024-10-11 09:59:35 +00:00
Nobuyoshi Nakada
caf0d2058a [ruby/time] [DOC] nodoc VERSION
This file is parsed as a part of Ruby documentation, and this constant
appears in the built-in Time class unexpectedly.

https://github.com/ruby/time/commit/f26f7ab689
2024-10-10 16:54:15 +00:00
Nobuyoshi Nakada
e6b9348eb9 [ruby/time] [DOC] Escape the word "Time" that does not mean Time class
https://github.com/ruby/time/commit/8572a306bb
2024-10-10 16:54:14 +00:00
Nobuyoshi Nakada
db352a5127 [ruby/time] [DOC] RDoc does not use backticks
https://github.com/ruby/time/commit/aefa245a20
2024-10-10 16:54:14 +00:00
Hiroshi SHIBATA
e17d91459c [ruby/time] Bump up v0.4.0
https://github.com/ruby/time/commit/a14fa00ef7
2024-09-06 00:31:38 +00:00
Jean Boussier
72acd1c8b1 [ruby/time] Do not redefine Time#xmlschema if it already exists
[Feature #20707]

Ruby 3.4 will define this method natively, so the time gem shouldn't
redefine it with a slower version.

https://github.com/ruby/time/commit/f05099ce38
2024-09-05 22:37:35 +00:00
Artur
e133d0c7a1 [ruby/time] Document exception thrown by Time.strptime
https://github.com/ruby/time/commit/f9d078082f
2024-04-19 10:32:04 +00:00
Yusuke Endoh
25d74b9527 Do not include a backtick in error messages and backtraces
[Feature #16495]
2024-02-15 18:42:31 +09:00
Hiroshi SHIBATA
360607c7f1 [ruby/time] Bump up 0.3.0
https://github.com/ruby/time/commit/8dba14997c
2023-11-07 05:09:48 +00:00
Hiroshi SHIBATA
f09638fe25 [ruby/time] Expose Time::VERSION
https://github.com/ruby/time/commit/32793b56b7
2023-04-13 18:51:18 +09:00
Nobuyoshi Nakada
cbfd029985 [ruby/time] Make RFC2822 regexp linear
https://hackerone.com/reports/1485501

https://github.com/ruby/time/commit/51034bda4c
2023-03-30 10:44:39 +00:00
Nobuyoshi Nakada
aa3885501f [ruby/time] Fix quadratic backtracking on invalid time
https://hackerone.com/reports/1485501

https://github.com/ruby/time/commit/2444456fc1
2023-03-30 10:44:38 +00:00
Luka Dornhecker
4bf97a8ec4 fix typo in Time#xmlschema documentation 2022-07-29 19:10:10 +09:00
Yusuke Endoh
203eeeefdd Revert "disable shareable_constant_value for CI"
This reverts commit c647205c3eb1f17409a859149bb7d2ea38b43bed.

Maybe the root issue was fixed by 7ac078e5b67ba752a755d6bd9c3a99999767fd3a
2021-04-26 22:46:51 +09:00
Koichi Sasada
c647205c3e disable shareable_constant_value for CI
To debug CI failures on FreeBSD, disable `shareable_constant_value`.
2021-04-26 11:33:07 +09:00
Kir Shatrov
53d153e42c
[ruby/time] Make Time friendly to Ractor
https://github.com/ruby/time/commit/c784e4f166
2021-04-22 11:51:36 +09:00
Nobuyoshi Nakada
5307fab661
[ruby/time] Use Time#strftime to format
https://github.com/ruby/time/commit/6b8cc4799e
2021-01-15 19:04:33 +09:00
Nobuyoshi Nakada
1cb0c5ac49
[ruby/time] No document for private methods
https://github.com/ruby/time/commit/44a55daa70
2021-01-15 12:43:28 +09:00
Nobuyoshi Nakada
995923b7f9
[DOC] Mentioned that Time.parse method is not validator 2020-06-21 16:16:15 +09:00
Henrik Nyh and Tomas Skogberg
fdb31aa7ab Time.xmlschema: Clarify error and docs
It parses a (date)time, not a date.
2020-05-23 09:43:05 +09:00
Jeremy Evans
a9d4f2d03c Support %U/%u/%W/%w/%V/%g/%G formats in Time.strptime
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]
2019-11-21 03:32:20 +02:00
Kazuhiro NISHIYAMA
5251d18982
Time#strftime does not support %Q
```
% 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-11-06 09:46:48 +09:00
nobu
6629588aa5 Fix mday overflow
[ruby-core:90897] [Bug #15506]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-06 04:36:56 +00:00
kazu
fb2be0b530 Remove (nanosecond) too [ci skip]
[Bug #15322]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 02:53:57 +00:00
okkez
66ec94d546 time.rb: remove the unsupported formatting options from the document [ci skip]
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-12-03 02:34:23 +00:00
kazu
d7e3043463 Remove unused variable in example code [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-29 09:22:13 +00:00
nobu
8ea6c92eb3 time.rb: Move documents and stop others
* 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-11-29 01:09:47 +00:00
nobu
7f9089a186 Time.parse based from non-Time object
* 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-10-09 05:55:29 +00:00
kazu
ba3da08596 [DOC] Add %Q and %+ to strptime [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-01 01:37:12 +00:00
nobu
728b75bc9b time.rb: yday support
* 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-07-24 07:47:01 +00:00
nobu
dc2a979b7f time.rb: fix parsing time zone in iso8601
* 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-28 15:35:08 +00:00
nobu
71fed537ac time.rb: fix parsing time zone in iso8601
* 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-05-28 15:19:38 +00:00
nobu
1b91e1ce32 Use Regexp#match? in time.rb for conditionals
[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
2018-03-28 10:22:57 +00:00
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