本文へ移動
セクション
Fiesta

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="{&#34;ago&#34;:&#34;前|まえ&#34;,&#34;am&#34;:&#34;午前|am&#34;,&#34;at&#34;:&#34;に&#34;,&#34;day&#34;:&#34;日&#34;,&#34;hour&#34;:&#34;時間|時&#34;,&#34;in&#34;:&#34;後|あと&#34;,&#34;last&#34;:&#34;先|昨|去&#34;,&#34;midnight&#34;:&#34;深夜|真夜中&#34;,&#34;minute&#34;:&#34;分&#34;,&#34;month&#34;:&#34;か月|ヶ月|カ月|月&#34;,&#34;next&#34;:&#34;来|次|翌&#34;,&#34;noon&#34;:&#34;正午|昼&#34;,&#34;pm&#34;:&#34;午後|pm&#34;,&#34;today&#34;:&#34;今日|きょう|本日&#34;,&#34;tomorrow&#34;:&#34;明日|あした|あす&#34;,&#34;week&#34;:&#34;週間|週&#34;,&#34;yesterday&#34;:&#34;昨日|きのう&#34;}" 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="{&#34;ago&#34;:&#34;前|まえ&#34;,&#34;am&#34;:&#34;午前|am&#34;,&#34;at&#34;:&#34;に&#34;,&#34;day&#34;:&#34;日&#34;,&#34;hour&#34;:&#34;時間|時&#34;,&#34;in&#34;:&#34;後|あと&#34;,&#34;last&#34;:&#34;先|昨|去&#34;,&#34;midnight&#34;:&#34;深夜|真夜中&#34;,&#34;minute&#34;:&#34;分&#34;,&#34;month&#34;:&#34;か月|ヶ月|カ月|月&#34;,&#34;next&#34;:&#34;来|次|翌&#34;,&#34;noon&#34;:&#34;正午|昼&#34;,&#34;pm&#34;:&#34;午後|pm&#34;,&#34;today&#34;:&#34;今日|きょう|本日&#34;,&#34;tomorrow&#34;:&#34;明日|あした|あす&#34;,&#34;week&#34;:&#34;週間|週&#34;,&#34;yesterday&#34;:&#34;昨日|きのう&#34;}" 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="{&#34;ago&#34;:&#34;前|まえ&#34;,&#34;am&#34;:&#34;午前|am&#34;,&#34;at&#34;:&#34;に&#34;,&#34;day&#34;:&#34;日&#34;,&#34;hour&#34;:&#34;時間|時&#34;,&#34;in&#34;:&#34;後|あと&#34;,&#34;last&#34;:&#34;先|昨|去&#34;,&#34;midnight&#34;:&#34;深夜|真夜中&#34;,&#34;minute&#34;:&#34;分&#34;,&#34;month&#34;:&#34;か月|ヶ月|カ月|月&#34;,&#34;next&#34;:&#34;来|次|翌&#34;,&#34;noon&#34;:&#34;正午|昼&#34;,&#34;pm&#34;:&#34;午後|pm&#34;,&#34;today&#34;:&#34;今日|きょう|本日&#34;,&#34;tomorrow&#34;:&#34;明日|あした|あす&#34;,&#34;week&#34;:&#34;週間|週&#34;,&#34;yesterday&#34;:&#34;昨日|きのう&#34;}" 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>