ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:101780] [Ruby master Feature#17485] Keyword argument for timezone in Time.new
@ 2020-12-28 14:04 nobu
  2021-01-12  6:30 ` [ruby-core:102023] " akr
  0 siblings, 1 reply; 2+ messages in thread
From: nobu @ 2020-12-28 14:04 UTC (permalink / raw)
  To: ruby-core

Issue #17485 has been reported by nobu (Nobuyoshi Nakada).

----------------------------------------
Feature #17485: Keyword argument for timezone in Time.new
https://bugs.ruby-lang.org/issues/17485

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
----------------------------------------
Currently, `Time.at` and `Time.now` accept a timezone as a keyword argument, but not `Time.new`.
This means minor arguments cannot be omitted for `Time.new`.

```ruby
Time.new(2021, 1, 1, 0, 0, 0, "+09:00") #=> ok: 2021-01-01 00:00:00 +0900
Time.new(2021, 1, 1, "+09:00")          #=> bad: 2021-01-01 09:00:00 +0900
Time.new(2021, 1, "+09:00")             #=> bad: 2021-01-09 00:00:00 +0900
Time.new(2021, "+09:00")                #=> ArgumentError (mon out of range)
```

Suggest that Time.new should also accept the `in:` timezone option.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:102023] [Ruby master Feature#17485] Keyword argument for timezone in Time.new
  2020-12-28 14:04 [ruby-core:101780] [Ruby master Feature#17485] Keyword argument for timezone in Time.new nobu
@ 2021-01-12  6:30 ` akr
  0 siblings, 0 replies; 2+ messages in thread
From: akr @ 2021-01-12  6:30 UTC (permalink / raw)
  To: ruby-core

Issue #17485 has been updated by akr (Akira Tanaka).


I think `Time.new(2021, 1, 1, "+09:99")` should raise an error instead of `2021-01-01 09:00:00 +0900`.

----------------------------------------
Feature #17485: Keyword argument for timezone in Time.new
https://bugs.ruby-lang.org/issues/17485#change-89871

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
----------------------------------------
Currently, `Time.at` and `Time.now` accept a timezone as a keyword argument, but not `Time.new`.
This means minor arguments cannot be omitted for `Time.new`.

```ruby
Time.new(2021, 1, 1, 0, 0, 0, "+09:00") #=> ok: 2021-01-01 00:00:00 +0900
Time.new(2021, 1, 1, "+09:00")          #=> bad: 2021-01-01 09:00:00 +0900
Time.new(2021, 1, "+09:00")             #=> bad: 2021-01-09 00:00:00 +0900
Time.new(2021, "+09:00")                #=> ArgumentError (mon out of range)
```

Suggest that `Time.new` should also accept the `in:` timezone option.

```ruby
Time.new(2021, 1, 1, in: "+09:00") #=> ok: 2021-01-01 00:00:00 +0900
Time.new(2021, in: "+09:00")       #=> ok: 2021-01-01 00:00:00 +0900
```

https://github.com/ruby/ruby/pull/4010



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-12  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 14:04 [ruby-core:101780] [Ruby master Feature#17485] Keyword argument for timezone in Time.new nobu
2021-01-12  6:30 ` [ruby-core:102023] " akr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).