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 { "formatDate": func(time time.Time) template.HTML {
return template.HTML(`<time datetime="` + time.Format(database.ISODateFormat) + `">` + time.Format("02/01/2006") + "</time>") 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 { "tomorrow": func() string {
return time.Now().AddDate(0, 0, 1).Format(database.ISODateFormat) 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 { "queryEscape": func(s string) string {
return url.QueryEscape(s) return url.QueryEscape(s)
}, },

View File

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

View File

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