Advance min dates of departure and arrival one day

Apparently, expecting people to book at least one day in advance is
being “too optimistic”.
This commit is contained in:
jordi fita mas 2024-02-02 02:59:41 +01:00
parent 97fb88cc02
commit b6044a7d4a
3 changed files with 7 additions and 7 deletions

View File

@ -107,12 +107,12 @@ func mustRenderLayout(w io.Writer, user *auth.User, company *auth.Company, templ
"formatDate": func(time time.Time) template.HTML {
return template.HTML(`<time datetime="` + time.Format(database.ISODateFormat) + `">` + time.Format("02/01/2006") + "</time>")
},
"today": func() string {
return time.Now().Format(database.ISODateFormat)
},
"tomorrow": func() string {
return time.Now().AddDate(0, 0, 1).Format(database.ISODateFormat)
},
"overmorrow": func() string {
return time.Now().AddDate(0, 0, 2).Format(database.ISODateFormat)
},
"queryEscape": func(s string) string {
return url.QueryEscape(s)
},

View File

@ -128,7 +128,7 @@
<label>
{{( pgettext "Arrival date" "input" )}}<br>
<input type="date" required
min="{{ tomorrow }}"
min="{{ today }}"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
</label>
@ -138,7 +138,7 @@
<label>
{{( pgettext "Departure date" "input" )}}<br>
<input type="date" required
min="{{ overmorrow }}"
min="{{ tomorrow }}"
name="{{ .Name }}" value="{{ .Val }}" {{ template "error-attrs" . }}
><br>
</label>

View File

@ -40,13 +40,13 @@
<label>
{{( pgettext "Check-in Date" "input")}}
<br>
<input name="arrival_date" type="date" min="{{ tomorrow }}" required>
<input name="arrival_date" type="date" min="{{ today }}" required>
<br>
</label>
<label>
{{( pgettext "Check-out Date" "input")}}
<br>
<input name="departure_date" type="date" min="{{ overmorrow }}"
<input name="departure_date" type="date" min="{{ tomorrow }}"
data-min-nights="{{ .MinNights}}" data-max-nights="{{ .MaxNights }}"
>
<br>