ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:74845] [Ruby trunk Bug#12259] DateTime.parse does not take into account system time
       [not found] <redmine.issue-12259.20160407155742@ruby-lang.org>
@ 2016-04-07 15:57 ` sonots
  2016-04-07 15:58 ` [ruby-core:74846] [Ruby trunk Bug#12259] DateTime.parse does not take into account the system timezone sonots
  2019-06-26 19:39 ` [ruby-core:93370] " merch-redmine
  2 siblings, 0 replies; 3+ messages in thread
From: sonots @ 2016-04-07 15:57 UTC (permalink / raw
  To: ruby-core

Issue #12259 has been reported by Naotoshi Seo.

----------------------------------------
Bug #12259: DateTime.parse does not take into account system time
https://bugs.ruby-lang.org/issues/12259

* Author: Naotoshi Seo
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
DateTime.parse does not take into account the system timezone although Time.parse does take into account the system timezone.

```
irb(main):002:0> DateTime.parse('2011-10-10 10:00:00')
=> #<DateTime: 2011-10-10T10:00:00+00:00 ((2455845j,36000s,0n),+0s,2299161j)>
irb(main):005:0> Time.parse('2011-10-10 10:00:00')
=> 2011-10-10 10:00:00 +0900
```

Are there any reasons that `DateTime.parse` behaves like this?
Can this behavior  be changed, or do we have to keep this behavior for lower version compatibility?



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

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

* [ruby-core:74846] [Ruby trunk Bug#12259] DateTime.parse does not take into account the system timezone
       [not found] <redmine.issue-12259.20160407155742@ruby-lang.org>
  2016-04-07 15:57 ` [ruby-core:74845] [Ruby trunk Bug#12259] DateTime.parse does not take into account system time sonots
@ 2016-04-07 15:58 ` sonots
  2019-06-26 19:39 ` [ruby-core:93370] " merch-redmine
  2 siblings, 0 replies; 3+ messages in thread
From: sonots @ 2016-04-07 15:58 UTC (permalink / raw
  To: ruby-core

Issue #12259 has been updated by Naotoshi Seo.

Subject changed from DateTime.parse does not take into account system time to DateTime.parse does not take into account the system timezone

----------------------------------------
Bug #12259: DateTime.parse does not take into account the system timezone
https://bugs.ruby-lang.org/issues/12259#change-57975

* Author: Naotoshi Seo
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
DateTime.parse does not take into account the system timezone although Time.parse does take into account the system timezone.

```
irb(main):002:0> DateTime.parse('2011-10-10 10:00:00')
=> #<DateTime: 2011-10-10T10:00:00+00:00 ((2455845j,36000s,0n),+0s,2299161j)>
irb(main):005:0> Time.parse('2011-10-10 10:00:00')
=> 2011-10-10 10:00:00 +0900
```

Are there any reasons that `DateTime.parse` behaves like this?
Can this behavior  be changed, or do we have to keep this behavior for lower version compatibility?



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

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

* [ruby-core:93370] [Ruby trunk Bug#12259] DateTime.parse does not take into account the system timezone
       [not found] <redmine.issue-12259.20160407155742@ruby-lang.org>
  2016-04-07 15:57 ` [ruby-core:74845] [Ruby trunk Bug#12259] DateTime.parse does not take into account system time sonots
  2016-04-07 15:58 ` [ruby-core:74846] [Ruby trunk Bug#12259] DateTime.parse does not take into account the system timezone sonots
@ 2019-06-26 19:39 ` merch-redmine
  2 siblings, 0 replies; 3+ messages in thread
From: merch-redmine @ 2019-06-26 19:39 UTC (permalink / raw
  To: ruby-core

Issue #12259 has been updated by jeremyevans0 (Jeremy Evans).


I do not think this is a bug.  DateTime has always defaulted to UTC, not just in `DateTime.parse`:

```ruby
DateTime.new.zone
# => "+00:00"

DateTime.strptime('2009', '%Y').zone
# => "+00:00"

DateTime.jd(2458000)
# => "+00:00"
```

To switch to defaulting to local time for compatibility with `Time` would be a huge break to backwards compatibility, and I don't think such a change is worthwhile.  I think `DateTime` mostly exists for backwards compatibility, since starting in Ruby 2.6, `Time` can handle timezones (timezone handling was the last major advantage of `DateTime` over `Time`).

----------------------------------------
Bug #12259: DateTime.parse does not take into account the system timezone
https://bugs.ruby-lang.org/issues/12259#change-78894

* Author: sonots (Naotoshi Seo)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
DateTime.parse does not take into account the system timezone although Time.parse does take into account the system timezone.

```
irb(main):002:0> DateTime.parse('2011-10-10 10:00:00')
=> #<DateTime: 2011-10-10T10:00:00+00:00 ((2455845j,36000s,0n),+0s,2299161j)>
irb(main):005:0> Time.parse('2011-10-10 10:00:00')
=> 2011-10-10 10:00:00 +0900
```

Are there any reasons that `DateTime.parse` behaves like this?
Can this behavior  be changed, or do we have to keep this behavior for lower version compatibility?



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

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

end of thread, other threads:[~2019-06-26 19:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-12259.20160407155742@ruby-lang.org>
2016-04-07 15:57 ` [ruby-core:74845] [Ruby trunk Bug#12259] DateTime.parse does not take into account system time sonots
2016-04-07 15:58 ` [ruby-core:74846] [Ruby trunk Bug#12259] DateTime.parse does not take into account the system timezone sonots
2019-06-26 19:39 ` [ruby-core:93370] " merch-redmine

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).