field-daterange
Fecha y hora Los cuatro campos que datetime.js mejora, cada uno conservando debajo su control nativo, de modo que quien no tenga scripts obtiene el control sencillo y no uno roto.
Un inicio y un fin como un solo fieldset etiquetado. Da a cada campo su propio name y su propio id.
Cada ejemplo funciona de verdad, pero sus enlaces no llevan a ninguna parte. HTML muestra el marcado para copiar.
Fecha y hora, con valores iniciales
Confirma el inicio con el fin todavía vacío y datetime.js rellena el fin una hora más tarde. Nada en el marcado lo hace; lo hace el script.
Pon esto dentro de <section rst-box><form rst-form>.
<fieldset rst-field-range >
<legend >Cuándo</legend >
<div rst-field-row data-rst-range ="session" >
<div rst-field >
<label rst-field-label for ="dr_starts_at" >Empieza</label >
<input rst-input id ="dr_starts_at" name ="dr_starts_at" type ="datetime-local" value ="2026-09-04T19:30" data-rst-date data-rst-date-words ="{"ago":"hace","am":"am|a.m.","at":"a|las|la","day":"día|dia|días|dias","hour":"hora|horas|h","in":"en","last":"pasado|pasada|último|ultimo|última|ultima|anterior","midnight":"medianoche","minute":"minuto|minutos|min|mins|m","month":"mes|meses","next":"próximo|proximo|próxima|proxima|siguiente","noon":"mediodía|mediodia","pm":"pm|p.m.|tarde|noche","today":"hoy","tomorrow":"mañana|manana","week":"semana|semanas","yesterday":"ayer"}" data-rst-date-set ="Establecer" data-rst-date-hint ="Prueba: {example}" data-rst-date-pick ="Abrir el calendario" data-rst-date-calendar ="Calendario" data-rst-date-prev-month ="Mes anterior" data-rst-date-next-month ="Mes siguiente" data-rst-date-results ="{n} sugerencias" data-rst-date-result-one ="1 sugerencia" data-rst-date-quick-today ="Hoy" data-rst-date-quick-tomorrow ="Mañana" data-rst-date-quick-next-week ="Dentro de una semana" data-rst-date-quick-plus-1h ="Una hora después" data-rst-date-quick-plus-2h ="Dos horas después" data-rst-date-quick-end-of-day ="Final de ese día" data-rst-date-quick-next-day ="A la misma hora del día siguiente" >
</div >
<div rst-field >
<label rst-field-label for ="dr_ends_at" >Termina</label >
<input rst-input id ="dr_ends_at" name ="dr_ends_at" type ="datetime-local" data-rst-date data-rst-date-words ="{"ago":"hace","am":"am|a.m.","at":"a|las|la","day":"día|dia|días|dias","hour":"hora|horas|h","in":"en","last":"pasado|pasada|último|ultimo|última|ultima|anterior","midnight":"medianoche","minute":"minuto|minutos|min|mins|m","month":"mes|meses","next":"próximo|proximo|próxima|proxima|siguiente","noon":"mediodía|mediodia","pm":"pm|p.m.|tarde|noche","today":"hoy","tomorrow":"mañana|manana","week":"semana|semanas","yesterday":"ayer"}" data-rst-date-set ="Establecer" data-rst-date-hint ="Prueba: {example}" data-rst-date-pick ="Abrir el calendario" data-rst-date-calendar ="Calendario" data-rst-date-prev-month ="Mes anterior" data-rst-date-next-month ="Mes siguiente" data-rst-date-results ="{n} sugerencias" data-rst-date-result-one ="1 sugerencia" data-rst-date-quick-today ="Hoy" data-rst-date-quick-tomorrow ="Mañana" data-rst-date-quick-next-week ="Dentro de una semana" data-rst-date-quick-plus-1h ="Una hora después" data-rst-date-quick-plus-2h ="Dos horas después" data-rst-date-quick-end-of-day ="Final de ese día" data-rst-date-quick-next-day ="A la misma hora del día siguiente" >
</div >
</div >
</fieldset >
Solo fechas, con un error en el fin
Pon esto dentro de <section rst-box><form rst-form>.
<fieldset rst-field-range >
<legend >Reserva</legend >
<div rst-field-row data-rst-range >
<div rst-field >
<label rst-field-label for ="dr_from" >Desde</label >
<input rst-input id ="dr_from" name ="dr_from" type ="date" value ="2026-09-04" data-rst-date data-rst-date-words ="{"ago":"hace","am":"am|a.m.","at":"a|las|la","day":"día|dia|días|dias","hour":"hora|horas|h","in":"en","last":"pasado|pasada|último|ultimo|última|ultima|anterior","midnight":"medianoche","minute":"minuto|minutos|min|mins|m","month":"mes|meses","next":"próximo|proximo|próxima|proxima|siguiente","noon":"mediodía|mediodia","pm":"pm|p.m.|tarde|noche","today":"hoy","tomorrow":"mañana|manana","week":"semana|semanas","yesterday":"ayer"}" data-rst-date-set ="Establecer" data-rst-date-hint ="Prueba: {example}" data-rst-date-pick ="Abrir el calendario" data-rst-date-calendar ="Calendario" data-rst-date-prev-month ="Mes anterior" data-rst-date-next-month ="Mes siguiente" data-rst-date-results ="{n} sugerencias" data-rst-date-result-one ="1 sugerencia" data-rst-date-quick-today ="Hoy" data-rst-date-quick-tomorrow ="Mañana" data-rst-date-quick-next-week ="Dentro de una semana" data-rst-date-quick-plus-1h ="Una hora después" data-rst-date-quick-plus-2h ="Dos horas después" data-rst-date-quick-end-of-day ="Final de ese día" data-rst-date-quick-next-day ="A la misma hora del día siguiente" >
</div >
<div rst-field >
<label rst-field-label for ="dr_to" >Hasta</label >
<input rst-input id ="dr_to" name ="dr_to" type ="date" value ="2026-09-01" aria-invalid ="true" aria-describedby ="dr_to-error" data-rst-date data-rst-date-words ="{"ago":"hace","am":"am|a.m.","at":"a|las|la","day":"día|dia|días|dias","hour":"hora|horas|h","in":"en","last":"pasado|pasada|último|ultimo|última|ultima|anterior","midnight":"medianoche","minute":"minuto|minutos|min|mins|m","month":"mes|meses","next":"próximo|proximo|próxima|proxima|siguiente","noon":"mediodía|mediodia","pm":"pm|p.m.|tarde|noche","today":"hoy","tomorrow":"mañana|manana","week":"semana|semanas","yesterday":"ayer"}" data-rst-date-set ="Establecer" data-rst-date-hint ="Prueba: {example}" data-rst-date-pick ="Abrir el calendario" data-rst-date-calendar ="Calendario" data-rst-date-prev-month ="Mes anterior" data-rst-date-next-month ="Mes siguiente" data-rst-date-results ="{n} sugerencias" data-rst-date-result-one ="1 sugerencia" data-rst-date-quick-today ="Hoy" data-rst-date-quick-tomorrow ="Mañana" data-rst-date-quick-next-week ="Dentro de una semana" data-rst-date-quick-plus-1h ="Una hora después" data-rst-date-quick-plus-2h ="Dos horas después" data-rst-date-quick-end-of-day ="Final de ese día" data-rst-date-quick-next-day ="A la misma hora del día siguiente" >
<small rst-field-error id ="dr_to-error" >El final es anterior al inicio.</small >
</div >
</div >
</fieldset >