Date and time <input> types
date、time、datetime-local、month、week などの <input> タイプは、日付と時刻の入力に特化したUIを提供します。
概要
date、time、datetime-local、month、week などの <input> タイプは、日付と時刻の入力に特化したUIを提供します。
対応ブラウザ
デスクトップ
Chrome 20+
Edge 12+
Safari 14.1+
Firefox 57+
モバイル
Chrome Android 25+
Safari iOS 5+
Firefox Android 57+
基本構文
HTML
<label>日付: <input type="date" name="date"></label>
<label>時刻: <input type="time" name="time"></label>
<label>日時: <input type="datetime-local" name="datetime"></label>
<label>月: <input type="month" name="month"></label> 実務での使いどころ
-
Date and time <input> types の活用
日付・時刻入力の <input> タイプ。date、time、datetime-local などに対応。
注意点
- 古いブラウザでは対応していない場合がある。
アクセシビリティ
- スクリーンリーダーでの読み上げを確認すること。