19 lines
270 B
Go
19 lines
270 B
Go
package merch
|
|
|
|
import (
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
func getPeriod(days string) time.Time {
|
|
daysInt, err := strconv.Atoi(days)
|
|
if err != nil {
|
|
daysInt = 7
|
|
}
|
|
|
|
if daysInt > 365 {
|
|
daysInt = 7
|
|
}
|
|
|
|
return time.Now().UTC().Add(-(time.Duration(daysInt) * time.Hour * 24))
|
|
}
|