teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

ES3017 -> ES2017

2017/09/13 16:50

投稿

think49
think49

スコア18194

answer CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > ...この為のJavaScirptのメソッドというのは存在するのでしょうか?
4
4
 
5
- 少なくとも、ES3017にネイティブ関数はなく、自分で実装するしかなさそうなので、作ってみました。
5
+ 少なくとも、ES2017にネイティブ関数はなく、自分で実装するしかなさそうなので、作ってみました。
6
6
 
7
7
  - [toISOLocalString(): 現在のロケールに対応した「ISO 8601 拡張形式」の日付文字列を返します - Gist](https://gist.github.com/think49/910b913051cc94e765f1bc347d5089db)
8
8
  - [String.prototype.padStart, String.prototype.padEnd の Polyfill (ECMAScript 2017 / ECMA-262 8th edition) - Gist](https://gist.github.com/think49/d0e01c82c12bda2d27d8)

2

gist

2017/09/13 16:50

投稿

think49
think49

スコア18194

answer CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  少なくとも、ES3017にネイティブ関数はなく、自分で実装するしかなさそうなので、作ってみました。
6
6
 
7
- - [toISOLocalString(): 現在のロケールに対応した「ISO 8601 拡張形式」の日付文字列を返します](https://gist.github.com/think49/910b913051cc94e765f1bc347d5089db)
7
+ - [toISOLocalString(): 現在のロケールに対応した「ISO 8601 拡張形式」の日付文字列を返します - Gist](https://gist.github.com/think49/910b913051cc94e765f1bc347d5089db)
8
- - [String.prototype.padStart, String.prototype.padEnd の Polyfill (ECMAScript 2017 / ECMA-262 8th edition)](https://gist.github.com/think49/d0e01c82c12bda2d27d8)
8
+ - [String.prototype.padStart, String.prototype.padEnd の Polyfill (ECMAScript 2017 / ECMA-262 8th edition) - Gist](https://gist.github.com/think49/d0e01c82c12bda2d27d8)
9
9
 
10
10
  ```JavaScript
11
11
  console.log(toISOLocalString(new Date('2014-10-10T04:50:40Z'))); // "2014-10-10T13:50:40.000+09:00"

1

単純に9時間を足してあげれば良いだけの話?

2017/09/13 15:00

投稿

think49
think49

スコア18194

answer CHANGED
@@ -11,6 +11,10 @@
11
11
  console.log(toISOLocalString(new Date('2014-10-10T04:50:40Z'))); // "2014-10-10T13:50:40.000+09:00"
12
12
  ```
13
13
 
14
+ > 単純に9時間を足してあげれば良いだけの話なのでしょうか?
15
+
16
+ そういう考え方もありますが、`getFullYear`, `getMonth`, `getDate`...etc は、現在のロケールに対応した数値を返す仕様なので、一度、date オブジェクトに変換すれば、楽に出力できると思います。
17
+
14
18
  ### 省略記法
15
19
 
16
20
  > 文字列「2014-10-10T13:50:40+09:00」