diff --git a/go.mod b/go.mod index b110535..666bba5 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/SebastiaanKlippert/go-wkhtmltopdf v1.9.0 github.com/brianvoe/gofakeit/v6 v6.23.2 github.com/disintegration/gift v1.2.1 + github.com/dustin/go-humanize v1.0.1 github.com/go-sql-driver/mysql v1.6.0 github.com/golang-jwt/jwt/v4 v4.5.0 ) diff --git a/go.sum b/go.sum index bf3e3fe..793d61d 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/brianvoe/gofakeit/v6 v6.23.2 h1:lVde18uhad5wII/f5RMVFLtdQNE0HaGFuBUXm github.com/brianvoe/gofakeit/v6 v6.23.2/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8= github.com/disintegration/gift v1.2.1 h1:Y005a1X4Z7Uc+0gLpSAsKhWi4qLtsdEcMIbbdvdZ6pc= github.com/disintegration/gift v1.2.1/go.mod h1:Jh2i7f7Q2BM7Ezno3PhfezbR1xpUg9dUg3/RlKGr4HI= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= diff --git a/skouter.go b/skouter.go index ebbefd9..c49e584 100644 --- a/skouter.go +++ b/skouter.go @@ -25,6 +25,7 @@ import ( "github.com/golang-jwt/jwt/v4" "github.com/disintegration/gift" "github.com/brianvoe/gofakeit/v6" + "github.com/dustin/go-humanize" "image" "image/png" _ "image/jpeg" @@ -264,7 +265,7 @@ func cache(name string, title string) Page { func cachePdf(name string) Page { // Money is stored in cents, so it must be converted to dollars in reports dollars := func(cents int) string { - return strconv.FormatFloat(float64(cents)/100, 'f', 2, 32) + return humanize.Commaf(float64(cents)/100) } // For calculating down payments