// the find
jinzhu/now
Now is a time toolkit for golang
A small Go utility library for boundary calculations on time values — beginning/end of minute, hour, day, week, month, quarter, year. It's from the author of GORM and gets pulled in transitively by a lot of Go projects as a result. Useful if you repeatedly need these truncation operations and don't want to write them yourself.
The Config struct lets you localize week-start day and timezone per instance rather than using globals, which matters for multi-tenant apps. The partial-format Parse is genuinely handy — passing '2017-10' and getting the first of the month is the kind of thing you'd otherwise write a switch statement for. The library is tiny (two source files) so auditing it takes 20 minutes. Active CI and recent commits despite its age.
The global `now.WeekStartDay` and `now.TimeFormats` package-level vars are a concurrency footgun — mutating them in tests or concurrent handlers will race. The Parse format list is order-dependent and underdocumented; if your input format matches two patterns, you get the first one silently. No support for fiscal year boundaries, ISO week numbers, or DST-aware arithmetic, so anything beyond calendar rounding sends you back to the standard library anyway. Panicking `MustParse` is included with no obvious justification for when that's safer than returning an error.