field-date
原生日期輸入框,加上 datetime.js 開嘅自然語言組合框(除非叫佢嗰陣傳咗 Plain)。試吓打「聽日」入去。
增強輸入:打「聽日」或者「3 個星期後」
<section rst-box><form rst-form method="post" action="#"><div rst-field>
<label rst-field-label for="field-date_live">Publish on</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="一個星期之後" data-rst-date-quick-plus-1h="一個鐘之後" data-rst-date-quick-plus-2h="兩個鐘之後" data-rst-date-quick-end-of-day="嗰日結束" data-rst-date-quick-next-day="第二日同一個時間">
<small rst-field-hint id="field-date_live-hint">The day it goes live.</small>
</div></form></section>
佢識解嘅字係經 data-rst-date-words 傳出去嘅,由呢一版嘅目錄查返嚟:個欄位解嘅就係呢一版用緊嗰種語言。
必填,仲有錯誤
<section rst-box><form rst-form method="post" action="#"><div rst-field>
<label rst-field-label for="field-date_error">Publish on <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="一個星期之後" data-rst-date-quick-plus-1h="一個鐘之後" data-rst-date-quick-plus-2h="兩個鐘之後" data-rst-date-quick-end-of-day="嗰日結束" data-rst-date-quick-next-day="第二日同一個時間">
<small rst-field-error id="field-date_error-error">Pick a date after today.</small>
</div></form></section>
有上下限
<section rst-box><form rst-form method="post" action="#"><div rst-field>
<label rst-field-label for="field-date_bounded">Within this year</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="一個星期之後" data-rst-date-quick-plus-1h="一個鐘之後" data-rst-date-quick-plus-2h="兩個鐘之後" data-rst-date-quick-end-of-day="嗰日結束" data-rst-date-quick-next-day="第二日同一個時間">
</div></form></section>
Plain——冇加嘢嘅原生輸入框
<section rst-box><form rst-form method="post" action="#"><div rst-field>
<label rst-field-label for="field-date_plain">Publish on</label>
<input rst-input id="field-date_plain" name="field-date_plain" type="date" value="2026-09-04">
</div></form></section>
完全冇加強用嘅屬性,所以 datetime.js 搵唔到嘢。原生揀選器照樣開得到。