mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
use std lib for time formatting
This commit is contained in:
parent
641605098f
commit
65423c176a
4 changed files with 13 additions and 11 deletions
|
|
@ -166,7 +166,7 @@ func (bs Service) BuildReport(period string, month, year int) *Report {
|
||||||
group by bookings.id
|
group by bookings.id
|
||||||
order by bookings.id;
|
order by bookings.id;
|
||||||
`,
|
`,
|
||||||
startDate.Format("2006-01-02"), endDate.Format("2006-01-02")).
|
startDate.Format(time.DateOnly), endDate.Format(time.DateOnly)).
|
||||||
Scan(&lines)
|
Scan(&lines)
|
||||||
|
|
||||||
cardTotal := 0.0
|
cardTotal := 0.0
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ func handleListBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFun
|
||||||
return &view.ListBookingsViewModel{
|
return &view.ListBookingsViewModel{
|
||||||
Id: b.InvoiceNumber(hc),
|
Id: b.InvoiceNumber(hc),
|
||||||
Url: templ.SafeURL(fmt.Sprintf("%s/%d", constant.RouteBooking, b.Id)),
|
Url: templ.SafeURL(fmt.Sprintf("%s/%d", constant.RouteBooking, b.Id)),
|
||||||
From: b.From.Format("2006-01-02"),
|
From: b.From.Format(time.DateOnly),
|
||||||
To: b.To.Format("2006-01-02"),
|
To: b.To.Format(time.DateOnly),
|
||||||
Platform: b.Platform,
|
Platform: b.Platform,
|
||||||
Name: b.CustomerName,
|
Name: b.CustomerName,
|
||||||
Total: strconv.FormatFloat(b.Total, 'f', 2, 64),
|
Total: strconv.FormatFloat(b.Total, 'f', 2, 64),
|
||||||
|
|
@ -90,8 +90,8 @@ func handleBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFunc {
|
||||||
PhoneNumber: b.PhoneNumber,
|
PhoneNumber: b.PhoneNumber,
|
||||||
CustomerNumber: strconv.Itoa(b.CustomerNumber),
|
CustomerNumber: strconv.Itoa(b.CustomerNumber),
|
||||||
Email: b.Email,
|
Email: b.Email,
|
||||||
From: b.From.Format("2006-01-02"),
|
From: b.From.Format(time.DateOnly),
|
||||||
To: b.To.Format("2006-01-02"),
|
To: b.To.Format(time.DateOnly),
|
||||||
Platform: b.Platform,
|
Platform: b.Platform,
|
||||||
PlatformFees: strconv.FormatFloat(b.PlatformFees, 'f', 2, 64),
|
PlatformFees: strconv.FormatFloat(b.PlatformFees, 'f', 2, 64),
|
||||||
Url: templ.EscapeString(fmt.Sprintf("%s/%d", constant.RouteBooking, b.Id)),
|
Url: templ.EscapeString(fmt.Sprintf("%s/%d", constant.RouteBooking, b.Id)),
|
||||||
|
|
@ -153,8 +153,8 @@ func handleUpdateBooking(bs *booking.Service, hc *config.Host) echo.HandlerFunc
|
||||||
PhoneNumber: b.PhoneNumber,
|
PhoneNumber: b.PhoneNumber,
|
||||||
CustomerNumber: strconv.Itoa(b.CustomerNumber),
|
CustomerNumber: strconv.Itoa(b.CustomerNumber),
|
||||||
Email: b.Email,
|
Email: b.Email,
|
||||||
From: b.From.Format("2006-01-02"),
|
From: b.From.Format(time.DateOnly),
|
||||||
To: b.To.Format("2006-01-02"),
|
To: b.To.Format(time.DateOnly),
|
||||||
Platform: b.Platform,
|
Platform: b.Platform,
|
||||||
Platforms: hc.Platforms,
|
Platforms: hc.Platforms,
|
||||||
PlatformFees: strconv.FormatFloat(b.PlatformFees, 'f', 2, 64),
|
PlatformFees: strconv.FormatFloat(b.PlatformFees, 'f', 2, 64),
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,8 @@ func handleComputeReport(bs *booking.Service, hc *config.Host) echo.HandlerFunc
|
||||||
Url: templ.SafeURL(fmt.Sprintf("%s/%d", constant.RouteBooking, l.Id)),
|
Url: templ.SafeURL(fmt.Sprintf("%s/%d", constant.RouteBooking, l.Id)),
|
||||||
Total: strconv.FormatFloat(l.Total, 'f', 2, 64),
|
Total: strconv.FormatFloat(l.Total, 'f', 2, 64),
|
||||||
CustomerName: l.CustomerName,
|
CustomerName: l.CustomerName,
|
||||||
From: l.From.Format("2006-01-02"),
|
From: l.From.Format(time.DateOnly),
|
||||||
To: l.To.Format("2006-01-02"),
|
To: l.To.Format(time.DateOnly),
|
||||||
Platform: l.Platform,
|
Platform: l.Platform,
|
||||||
PlatformFees: strconv.FormatFloat(l.PlatformFees, 'f', 2, 64),
|
PlatformFees: strconv.FormatFloat(l.PlatformFees, 'f', 2, 64),
|
||||||
Fee: strconv.FormatFloat(l.Fee(), 'f', 2, 64),
|
Fee: strconv.FormatFloat(l.Fee(), 'f', 2, 64),
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package time
|
package time
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
func ParseFromForm(src string) (time.Time, error) {
|
func ParseFromForm(src string) (time.Time, error) {
|
||||||
ts, err := time.Parse("2006-01-02", src)
|
ts, err := time.Parse(time.DateOnly, src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return time.Time{}, err
|
return time.Time{}, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue