field-date
日付と時刻 datetime.js が拡張する四つのフィールド。いずれも下にネイティブの入力要素を残すので、スクリプトのない読者には壊れたものではなく素のコントロールが届きます。
ネイティブの日付入力に、入力欄が data-rst-date を持つとき datetime.js が加える自然文コンボボックスを重ねたものです。「明日」 と入力してみてください。
どの例も実際に動きますが、リンクはどこにも移動しません。 HTML にはコピーできるマークアップがあります。
拡張された入力欄:「明日」や「3週間後」と入力できます
解釈できる語は data-rst-date-words にあり、ここではページの言語です。i18n/<lang>.json には十二の言語でそろっているので、ページがどの言語でも、フィールドはその言語を読み取れます。
これは <section rst-box><form rst-form> の中に置きます。
<div rst-field >
<label rst-field-label for ="field-date_live" >公開日</label >
<input rst-input id ="field-date_live" name ="field-date_live" type ="date" value ="2026-09-04" aria-describedby ="field-date_live-hint" data-rst-date data-rst-date-words ="{"ago":"前|まえ","am":"午前|am","at":"に","day":"日","hour":"時間|時","in":"後|あと","last":"先|昨|去","midnight":"深夜|真夜中","minute":"分","month":"か月|ヶ月|カ月|月","next":"来|次|翌","noon":"正午|昼","pm":"午後|pm","today":"今日|きょう|本日","tomorrow":"明日|あした|あす","week":"週間|週","yesterday":"昨日|きのう"}" data-rst-date-set ="設定" data-rst-date-hint ="入力例: {example}" data-rst-date-pick ="カレンダーを開く" data-rst-date-calendar ="カレンダー" data-rst-date-prev-month ="前の月" data-rst-date-next-month ="次の月" data-rst-date-results ="候補 {n} 件" data-rst-date-result-one ="候補 1 件" data-rst-date-quick-today ="今日" data-rst-date-quick-tomorrow ="明日" data-rst-date-quick-next-week ="1週間後" data-rst-date-quick-plus-1h ="1時間後" data-rst-date-quick-plus-2h ="2時間後" data-rst-date-quick-end-of-day ="その日の終わり" data-rst-date-quick-next-day ="翌日の同じ時刻" >
<small rst-field-hint id ="field-date_live-hint" >公開される日。</small >
</div >
必須、エラーつき
これは <section rst-box><form rst-form> の中に置きます。
<div rst-field >
<label rst-field-label for ="field-date_error" >公開日 <span rst-field-required aria-hidden ="true" >*</span ></label >
<input rst-input id ="field-date_error" name ="field-date_error" type ="date" required aria-invalid ="true" aria-describedby ="field-date_error-error" data-rst-date data-rst-date-words ="{"ago":"前|まえ","am":"午前|am","at":"に","day":"日","hour":"時間|時","in":"後|あと","last":"先|昨|去","midnight":"深夜|真夜中","minute":"分","month":"か月|ヶ月|カ月|月","next":"来|次|翌","noon":"正午|昼","pm":"午後|pm","today":"今日|きょう|本日","tomorrow":"明日|あした|あす","week":"週間|週","yesterday":"昨日|きのう"}" data-rst-date-set ="設定" data-rst-date-hint ="入力例: {example}" data-rst-date-pick ="カレンダーを開く" data-rst-date-calendar ="カレンダー" data-rst-date-prev-month ="前の月" data-rst-date-next-month ="次の月" data-rst-date-results ="候補 {n} 件" data-rst-date-result-one ="候補 1 件" data-rst-date-quick-today ="今日" data-rst-date-quick-tomorrow ="明日" data-rst-date-quick-next-week ="1週間後" data-rst-date-quick-plus-1h ="1時間後" data-rst-date-quick-plus-2h ="2時間後" data-rst-date-quick-end-of-day ="その日の終わり" data-rst-date-quick-next-day ="翌日の同じ時刻" >
<small rst-field-error id ="field-date_error-error" >今日より後の日付を選んでください。</small >
</div >
範囲つき
これは <section rst-box><form rst-form> の中に置きます。
<div rst-field >
<label rst-field-label for ="field-date_bounded" >今年中</label >
<input rst-input id ="field-date_bounded" name ="field-date_bounded" type ="date" value ="2026-09-04" min ="2026-01-01" max ="2026-12-31" data-rst-date data-rst-date-words ="{"ago":"前|まえ","am":"午前|am","at":"に","day":"日","hour":"時間|時","in":"後|あと","last":"先|昨|去","midnight":"深夜|真夜中","minute":"分","month":"か月|ヶ月|カ月|月","next":"来|次|翌","noon":"正午|昼","pm":"午後|pm","today":"今日|きょう|本日","tomorrow":"明日|あした|あす","week":"週間|週","yesterday":"昨日|きのう"}" data-rst-date-set ="設定" data-rst-date-hint ="入力例: {example}" data-rst-date-pick ="カレンダーを開く" data-rst-date-calendar ="カレンダー" data-rst-date-prev-month ="前の月" data-rst-date-next-month ="次の月" data-rst-date-results ="候補 {n} 件" data-rst-date-result-one ="候補 1 件" data-rst-date-quick-today ="今日" data-rst-date-quick-tomorrow ="明日" data-rst-date-quick-next-week ="1週間後" data-rst-date-quick-plus-1h ="1時間後" data-rst-date-quick-plus-2h ="2時間後" data-rst-date-quick-end-of-day ="その日の終わり" data-rst-date-quick-next-day ="翌日の同じ時刻" >
</div >
Plain:素のネイティブ入力
拡張用の属性がまったくないので、datetime.js には見つけるものがありません。ネイティブのピッカーはそれでも開きます。
これは <section rst-box><form rst-form> の中に置きます。
<div rst-field >
<label rst-field-label for ="field-date_plain" >公開日</label >
<input rst-input id ="field-date_plain" name ="field-date_plain" type ="date" value ="2026-09-04" >
</div >