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

回答編集履歴

1

formatter

2021/05/06 16:01

投稿

FromMZ1500
FromMZ1500

スコア496

answer CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  ```js
7
7
  const options = { weekday: 'short', month: 'numeric', day: 'numeric' };
8
- const formater = new Intl.DateTimeFormat('ja-JP-u-ca-japanese', options);
8
+ const formatter = new Intl.DateTimeFormat('ja-JP-u-ca-japanese', options);
9
9
 
10
10
  let chkday = new Date();
11
11
  const nextMonth = chkday.getMonth() + 1; // ※ 1月は 0
@@ -13,7 +13,7 @@
13
13
  for (let day = 1; day <= 31; day++) {
14
14
  chkday.setDate(day);
15
15
  if (chkday.getMonth() > nextMonth) break;
16
- document.write(formater.format(chkday) + "<br />");
16
+ document.write(formatter.format(chkday) + "<br />");
17
17
  }
18
18
 
19
19
  ```