field-time
日期同時間 datetime.js 加強嘅四個欄位,每個下面都保留原生輸入元件,所以冇腳本嘅讀者見到嘅係樸素嘅控件,唔係壞咗嘅。
一樣嘅外殼,今次包住原生時間輸入框。呢個加強讀嘅係鐘,唔係日曆。
每個例子都真係用得,不過入面啲連結唔會帶你去邊度。 HTML 顯示可以複製嘅標記。
增強輸入:打「七點半」或者「晏晝」
將呢段放入 <section rst-box><form rst-form> 入面。
<div rst-field >
<label rst-field-label for ="time_live" >開門時間</label >
<input rst-input id ="time_live" name ="time_live" type ="time" value ="19:30" aria-describedby ="time_live-hint" data-rst-time 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-pick-time ="打開時鐘" 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 ="time_live-hint" >當地時間。</small >
</div >
必填,仲有錯誤
將呢段放入 <section rst-box><form rst-form> 入面。
<div rst-field >
<label rst-field-label for ="time_error" >開門時間 <span rst-field-required aria-hidden ="true" >*</span ></label >
<input rst-input id ="time_error" name ="time_error" type ="time" required aria-invalid ="true" aria-describedby ="time_error-error" data-rst-time 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-pick-time ="打開時鐘" 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 ="time_error-error" >揀一個試音之後嘅時間。</small >
</div >
有上下限
將呢段放入 <section rst-box><form rst-form> 入面。
<div rst-field >
<label rst-field-label for ="time_bounded" >九點到十一點之間</label >
<input rst-input id ="time_bounded" name ="time_bounded" type ="time" value ="19:30" min ="09:00" max ="23:00" data-rst-time 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-pick-time ="打開時鐘" 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 >
Plain:冇加嘢嘅原生輸入框
將呢段放入 <section rst-box><form rst-form> 入面。
<div rst-field >
<label rst-field-label for ="time_plain" >開門時間</label >
<input rst-input id ="time_plain" name ="time_plain" type ="time" value ="19:30" >
</div >