Commit graph

39 commits

Author SHA1 Message Date
Andrew Konchin
8adc96b5ca [ruby/date] Skip tests failing on TruffleRuby
d019ac8186
2025-01-10 15:59:25 +00:00
Nobuyoshi Nakada
2e6f8554f8 [ruby/date] Remove the unintentional ability to parse Symbol
It's been 2 years since ruby/date#49, so it's okay.

435dfec6c8
2024-02-21 16:04:52 +00:00
Nobuyoshi Nakada
cb16dcb184 [ruby/date] The shrunk words to be copied is limited
Th buffer size is small enough and no need to allocate dynamically.

f62bf0a01d
2022-09-29 14:56:39 +09:00
Nobuyoshi Nakada
5a8aaedaff [ruby/date] Narrow ALLOCV region for shrunk words
f51b038074
2022-09-29 14:06:36 +09:00
Yusuke Endoh
ddd83e8462 test/date/test_date_parse.rb: relax the time limit
The timeout was very strict for weak CI machines like qemu-riscv.
Due to the additional overhead for Regexp.timeout=, it started failing
on such machines.

20220330T200018Z.fail.html.gz
```
  1) Error:
TestDateParse#test__parse_too_long_year:
Timeout::Error: execution expired
```
2022-03-31 12:52:16 +09:00
Nobuyoshi Nakada
8780f15fd7 [ruby/date] Use assert_deprecated_warn
c55004715a
2022-02-25 20:39:47 +09:00
Nobuyoshi Nakada
bb22bc76b0 [ruby/date] Deprecate the unintentional ability to parse Symbol
d57818f3b3
2022-02-25 19:57:50 +09:00
Nobuyoshi Nakada
d4f32b6b7b [ruby/date] Scale timeouts
2889698e2f
2022-02-25 19:52:33 +09:00
Nobuyoshi Nakada
4933d7fe56 [ruby/date] Update tests
5a138afce9
2022-02-25 19:52:32 +09:00
Nobuyoshi Nakada
b5c2a0840f [ruby/date] Anchor at beginning of numbers
https://hackerone.com/reports/1254844

2f7814cc22
2022-02-25 19:52:31 +09:00
Nobuyoshi Nakada
1758eade57 [ruby/date] Anchor at beginning of numbers
https://hackerone.com/reports/1254844

7ffe25e458
2022-02-25 19:52:31 +09:00
Jean Boussier
a87c56f820 [ruby/date] check_limit: also handle symbols
376c65942b
2021-11-16 22:51:41 +09:00
Jean Boussier
fa674cf723 [ruby/date] Date._<format>(nil) should return an empty Hash
Fix: https://github.com/ruby/date/issues/39

This is how versions previous to 3.2.1 behaved and Active Support
currently rely on this behavior.

90357af080/activesupport/lib/active_support/values/time_zone.rb (L383-L384)

Any Rails application upgrading to date `3.2.1` might run into unexpected errors.

8f2d7a0c7e
2021-11-16 22:51:40 +09:00
Yusuke Endoh
489c8cebf5 [ruby/date] Add length limit option for methods that parses date strings
`Date.parse` now raises an ArgumentError when a given date string is
longer than 128. You can configure the limit by giving `limit` keyword
arguments like `Date.parse(str, limit: 1000)`. If you pass `limit: nil`,
the limit is disabled.

Not only `Date.parse` but also the following methods are changed.

* Date._parse
* Date.parse
* DateTime.parse
* Date._iso8601
* Date.iso8601
* DateTime.iso8601
* Date._rfc3339
* Date.rfc3339
* DateTime.rfc3339
* Date._xmlschema
* Date.xmlschema
* DateTime.xmlschema
* Date._rfc2822
* Date.rfc2822
* DateTime.rfc2822
* Date._rfc822
* Date.rfc822
* DateTime.rfc822
* Date._jisx0301
* Date.jisx0301
* DateTime.jisx0301

3959accef8
2021-11-16 20:56:56 +09:00
Nobuyoshi Nakada
e68999c82c
Fixed misspellings
Fixed misspellings reported at [Bug #16437], for default gems.
2019-12-20 12:19:45 +09:00
Jeremy Evans
469545307f [ruby/date] Add more timezone abbreviations
This gets the time zone abbreviations from
https://www.timeanddate.com/time/zones/, and adds unambiguous time
zones not already present in zonetab.list.  See bin/update-abbr
for the program used.

This regenerates zonetab.h using prereq.mk (requires gperf).

Only one test line is added, just to make sure a new time zone
abbreviation is picked up.

Fixes Ruby Bug 16286

702e8b3033
2019-11-01 17:30:14 +09:00
glaszig
fce940aac7 [ruby/date] introduce Date::Error, raise Date::Error for every
"invalid <anything>" type of exception

3e55c09ba4
2019-10-31 15:51:25 +09:00
Jeremy Evans
2e37c1960a
[ruby/date] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous versions.

519470dc3b
2019-10-24 18:39:04 +09:00
Nobuyoshi Nakada
75fb0a9afa
Allow mday in Date.iso8601 to be omitted
[Bug #12285]
2019-07-16 09:41:23 +09:00
nobu
320c98b436 date: support for Reiwa, new Japanese era
[Feature #15742]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-09 01:27:36 +00:00
nobu
1329c7cdca date: make zone a substring to copy encoding and taintedness
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-03 10:56:36 +00:00
nobu
321d72bdd6 Added tests for end of Heisei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-01 05:58:31 +00:00
kazu
8edb6ce4f7 {ext,test}/date: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-27 00:29:21 +00:00
naruse
3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
hsbt
1e667d5fec * test/date/test_date.rb: remove commented-out code.
* test/date/test_date_arith.rb: ditto.
* test/date/test_date_attr.rb: ditto.
* test/date/test_date_parse.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-01 09:41:59 +00:00
nobu
ff7772062f date_parse.c: missing wday
* ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
  can be omitted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-21 18:16:00 +00:00
tadf
dafbdd6816 * ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-09 21:24:35 +00:00
tadf
cb9beafd11 * test/date/test_date_{parse,strptime}.rb: changed the format of
some extra messages.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-11 10:02:32 +00:00
tadf
9f773625e5 * ext/date/date_parse.c (iso8601_{ext,bas}_time): should not match
empty string.
- この行以下は無視されます --

M    ChangeLog
M    ext/date/date_parse.c
M    test/date/test_date_parse.rb


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-28 10:16:02 +00:00
tadf
280681f40c * ext/date/date_core.c: [ruby-core:47226].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-22 10:42:15 +00:00
tadf
49d65bc4d6 ext/date/date_parse.c: [ruby-core:42173].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-18 22:13:10 +00:00
tadf
c67712ef63 * test/date/test_*.rb: added tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-13 00:41:10 +00:00
tadf
614ec73fc8 * test/date/test_*.rb: added tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-14 13:52:25 +00:00
tadf
b3defabde2 * ext/date/lib/date/format.rb (_iso8601): allowed day only civil
date.  disallowed separatorless day only ordinal date.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 13:36:49 +00:00
nobu
fab47c96c5 * ksvndifftest/date/test_date_parse.rb: use UTF-8 literals.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-17 08:18:52 +00:00
tadf
cfed2cefb2 * lib/date/format.rb (strptime): removed \v; since \s includes \v.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 23:22:13 +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
tadf
1ac57f70e8 * test/date/*.rb: imported additional tests and some adjustments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-29 11:24:03 +00:00
tadf
0e395a6002 * test/date/*.rb: imported a date test suite ruby 1.9 limited ed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-28 10:06:13 +00:00