--- id: 587d778c367417b2b2512aa9 title: HTML5 の datetime 属性で時刻を標準化する challengeType: 0 videoUrl: 'https://scrimba.com/c/cmzMgtz' forumTopicId: 301025 dashedName: standardize-times-with-the-html5-datetime-attribute --- # --description-- 日付に関する話題を続けます。HTML5 では時刻を標準化する `time` 要素と `datetime` 属性が導入されました。 `time` 要素は、ページ上の日付や時刻をラップできるインライン要素です。 `datetime` 属性は、その日付の有効なフォーマットを保持します。 支援デバイスがこの値にアクセスします。 テキスト中で時刻が非公式または口語的な形式で記載されている場合であっても、標準化された形式の時刻を記述することで混乱を避けることができます。 例: ```html

Master Camper Cat officiated the cage match between Goro and Scorpion , which ended in a draw.

``` # --instructions-- Camper Cat の Mortal Kombat の調査結果が出ました! `Thursday, September 15th` というテキストの周りを `time` タグでラップし、`2016-09-15` が設定された `datetime` 属性を追加してください。 # --hints-- コードには `Thank you to everyone for responding to Master Camper Cat's survey.` のテキストを持つ `p` 要素と、`time` 要素が必要です。 ```js assert(timeElement); ``` 追加された `time` タグは `Thursday, September 15th` テキストをラップしなければなりません。 ```js assert( timeElement && timeElement?.innerHTML?.trim() === 'Thursday, September 15th' ); ``` `time` タグは空ではない `datetime` 属性を持つ必要があります。 ```js assert(datetimeAttr && datetimeAttr?.length); ``` 追加された `datetime` 属性には `2016-09-15` の値を設定する必要があります。 ```js assert(datetimeAttr === '2016-09-15'); ``` # --seed-- ## --after-user-code-- ```html ``` ## --seed-contents-- ```html

Tournaments

Mortal Kombat Tournament Survey Results

Thank you to everyone for responding to Master Camper Cat's survey. The best day to host the vaunted Mortal Kombat tournament is Thursday, September 15th. May the best ninja win!

Comments:

Posted by: Sub-Zero on

Johnny Cage better be there, I'll finish him!

Posted by: Doge on

Wow, much combat, so mortal.

Posted by: The Grim Reaper on

Looks like I'll be busy that day.

``` # --solutions-- ```html

Tournaments

Mortal Kombat Tournament Survey Results

Thank you to everyone for responding to Master Camper Cat's survey. The best day to host the vaunted Mortal Kombat tournament is . May the best ninja win!

Comments:

Posted by: Sub-Zero on

Johnny Cage better be there, I'll finish him!

Posted by: Doge on

Wow, much combat, so mortal.

Posted by: The Grim Reaper on

Looks like I'll be busy that day.

```