Initial commit: runnable Ask a Plumber First server.

This commit is contained in:
2026-08-21 23:30:15 -07:00
parent 7bc79af954
commit d167b9216a
38 changed files with 4174 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
package pacific
import (
"time"
_ "time/tzdata"
)
const Layout = "2006-01-02"
var Loc *time.Location
func init() {
loc, err := time.LoadLocation("America/Los_Angeles")
if err != nil {
panic(err)
}
Loc = loc
}
func HuntDate(t time.Time) string {
return t.In(Loc).Format(Layout)
}
func Today() string {
return HuntDate(time.Now())
}
func Yesterday() string {
now := time.Now().In(Loc)
y := time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, Loc)
return y.Format(Layout)
}
func Parse(date string) (time.Time, error) {
return time.ParseInLocation(Layout, date, Loc)
}
func Label(date string) string {
t, err := Parse(date)
if err != nil {
return date
}
return t.Format("January 2, 2006")
}
func IsToday(date string) bool {
return date == Today()
}
func IsYesterday(date string) bool {
return date == Yesterday()
}