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


nobu (Nobuyoshi Nakada) wrote:

> Note: JIS X 0301 states the era symbol is optional, but doesn't mention the default era in the case it is omitted.
> At the best, it will be defined by the application(s), I guess, like announcers in ISO/IEC 2022.

JIS X 0301:2002 is a Japanese translation of ISO 8601:2000 with era-description.

I think no-era representation is similar to truncation of ISO 8601:2000.
"truncation" provides a way to omit higher order component by mutual agreement:
describe the year 1985 as 85 for example.
(See Wikipedia https://en.wikipedia.org/wiki/ISO_8601#Truncated_representations )

I think no-era representation should also be interpreted by a mutual agreement.
In Ruby context, the agreement should be represented by the reference manual.
Unfortunately, the manual is not clear.
The manual of Date.jisx0301 describes the format as just "some typical JIS X 0301 formats"

Apart from that, "truncation" is removed at ISO 8601:2004.
So, it is reasonable to consider no-era representation as legacy feature.
(I don't know the future version of JIS X 0301, though.)

My idea:
- Document Date.jisx0301 interpret no-era representation as Heisei.
  This is appropriate because it is a legacy feature.
  And this is compatible as current version.
- Support "R" for Reiwa.
  I think the initial letter R is almost fixed and no-one lose with it.


----------------------------------------
Feature #15742: Add Date#jisx0301 support new Japanese era
https://bugs.ruby-lang.org/issues/15742#change-77421

* Author: kaishuu0123 (Koki Oyatsu)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
## Reproduce process

```
irb(main):002:0> require 'date'
=> true
irb(main):003:0> Date.new(2019, 5, 1).jisx0301
=> "H31.05.01"
```

* ruby version: trunk

## Result of reproduce process

```
irb(main):003:0> Date.new(2019, 5, 1).jisx0301
=> "H31.05.01"
```

## Expected result and the reason why you expect

```
irb(main):002:0> require 'date'
=> true
irb(main):003:0> Date.new(2019, 5, 1).jisx0301
=> "R01.05.01"
```

### reason

* new era (Reiwa?) starts from 2019/05/01
* refs: https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L7049
* I can't be sure that initial letter is "R".



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>