ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: shyouhei@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95598] [Ruby master Bug#16286] DateTime.parse timezone errors
Date: Thu, 31 Oct 2019 02:25:22 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-82387.20191031022521.37c6e907018ad1b3@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16286.20191031004653@ruby-lang.org

Issue #16286 has been updated by shyouhei (Shyouhei Urabe).


Curious where were those abbreviation from.  According to `git log -G`, It was introduced in this commit https://github.com/ruby/ruby/commit/dc9cd6a8c22ad04baa7498fd0cbc5d519ed73be0 but no description came with it.

Maybe it's better to follow authoritative information such as tzdata.

----------------------------------------
Bug #16286: DateTime.parse timezone errors
https://bugs.ruby-lang.org/issues/16286#change-82387

* Author: matt17r (Matthew LS)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Trying to parse a DateTime using Australian time zone abbreviations doesn't work:

```
>> DateTime.parse('2019-10-31 10:49:52.36400 AEST')
=> #<DateTime: 2019-10-31T10:49:52+00:00 ((2458788j,38992s,364000000n),+0s,2299161j)>
# offset is +00:00 not +10:00     ^^^^^^
```

As per [this comment on a Rails issue](https://github.com/rails/rails/issues/36972#issuecomment-526260754), timezones are listed in [ext/date/zonetab.list](https://github.com/ruby/ruby/blob/master/ext/date/zonetab.list). Should these abbreviations be correct or are they deprecated?

Steps to reproduce:
```
>> require 'date'
=> true
>> DateTime.parse('2019-10-31 10:49:52.36400 AEST').zone
=> +00:00 # expected +10:00
>> DateTime.parse('2019-10-31 10:49:52.36400 AEDT').zone
=> +00:00 # expected +11:00
>> DateTime.parse('2019-10-31 10:49:52.36400 EAST').zone
=> +10:00 # expected -06:00
>> DateTime.parse('2019-10-31 10:49:52.36400 EASST').zone
=> +00:00 # expected -05:00
```

Additional info:
[ext/date/zonetab.list](https://github.com/ruby/ruby/blob/master/ext/date/zonetab.list) lists "EAST" with an offset of +10. *EAST* is the abbreviation for Easter Island, not for Australia Eastern Standard Time.

References:
1. the most recent data from [IANA](https://data.iana.org/time-zones/releases/?C=M;O=D) ([2019c at time of writing](https://data.iana.org/time-zones/releases/tzdata2019c.tar.gz)) refers to the timezones as *AEST* (or *AEDT* for DST)
2. the [Australian government](https://www.australia.gov.au/about-australia/facts-and-figures/time-zones-and-daylight-saving) uses *AEST* (or *AEDT* for DST)
3. *EAST* isn't referenced by IANA but [there](https://www.worldtimeserver.com/time-zones/east/) [are](https://24timezones.com/time-zone/east) [several](https://time.is/EAST) [sources](https://www.timeanddate.com/time/zones/east) that use *EAST* for Easter Island, off the coast of Chile (-6 rather than +10).

---Files--------------------------------
DateTime_parse_AEST_timezone_issue.rb (479 Bytes)


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

  parent reply	other threads:[~2019-10-31  2:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-16286.20191031004653@ruby-lang.org>
2019-10-31  0:46 ` [ruby-core:95597] [Ruby master Bug#16286] DateTime.parse timezone errors MATTHEW
2019-10-31  2:25 ` shyouhei [this message]
2019-10-31 19:03 ` [ruby-core:95616] " merch-redmine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-82387.20191031022521.37c6e907018ad1b3@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).