func PrevWorkday(t time.Time) time.Time {
	for {
		t = t.AddDate(0, 0, -1)
		switch t.Weekday() {
		case time.Saturday, time.Sunday:
			continue
		}
		return t
	}
}
NextWorkday returns previous workday
package timeutil
import (
	"bytes"
	"fmt"
	"math"
	"strconv"
	"strings"
	"time"
	"pkg.re/essentialkaos/ek.v12/mathutil"
	"pkg.re/essentialkaos/ek.v12/pluralize"
)
const (
	_MINUTE int64 = 60
	_HOUR         = 3600
	_DAY          = 86400
	_WEEK         = 604800
)
func PrettyDuration(d interface{}) string {
	dur, ok := convertDuration(d)
	if !ok {
		return ""
	}
	if dur != 0 && dur < time.Second {
		return getPrettyShortDuration(dur)
	}
	return getPrettyLongDuration(dur)
}
func PrettyDurationInDays(d interface{}) string {
	dur, ok := convertDuration(d)
	if !ok {
		return ""
	}
	switch {
	case dur <= 5*time.Minute:
		return "just now"
	case dur <= time.Hour*24:
		return "today"
	}
	days := int(dur.Hours()) / 24
	return pluralize.PS(pluralize.En, "%d %s", days, "day", "days")
}
func ShortDuration(d interface{}, highPrecision ...bool) string {
	dur, ok := convertDuration(d)
	if !ok {
		return ""
	}
	if dur == 0 {
		return "0:00"
	}
	if len(highPrecision) != 0 && highPrecision[0] == true {
		return getShortDuration(dur, true)
	}
	return getShortDuration(dur, false)
}
func Format(d time.Time, f string) string {
	input := bytes.NewBufferString(f)
	output := bytes.NewBufferString("")
	for {
		r, _, err := input.ReadRune()
		if err != nil {
			break
		}
		switch r {
		case '%':
			replaceDateTag(d, input, output)
		default:
			output.WriteRune(r)
		}
	}
	return output.String()
}
func DurationToSeconds(d time.Duration) float64 {
	return float64(d) / 1000000000.0
}
func SecondsToDuration(d float64) time.Duration {
	return time.Duration(1000000000.0 * d)
}
func ParseDuration(dur string) (int64, error) {
	if dur == "" {
		return 0, nil
	}
	var err error
	var value string
	var result, valueInt int64
	for _, sym := range strings.ToLower(dur) {
		switch sym {
		case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
			value += string(sym)
		case 'w':
			valueInt, err = strconv.ParseInt(value, 10, 64)
			result += valueInt * _WEEK
			value = ""
		case 'd':
			valueInt, err = strconv.ParseInt(value, 10, 64)
			result += valueInt * _DAY
			value = ""
		case 'h':
			valueInt, err = strconv.ParseInt(value, 10, 64)
			result += valueInt * _HOUR
			value = ""
		case 'm':
			valueInt, err = strconv.ParseInt(value, 10, 64)
			result += valueInt * _MINUTE
			value = ""
		case 's':
			valueInt, err = strconv.ParseInt(value, 10, 64)
			result += valueInt
			value = ""
		default:
			return 0, fmt.Errorf("Unsupported symbol \"%s\"", string(sym))
		}
		if err != nil {
			return 0, err
		}
	}
	if value != "" {
		valueInt, err = strconv.ParseInt(value, 10, 64)
		if err != nil {
			return 0, err
		}
		result += valueInt
	}
	return result, nil
}
func PrevDay(t time.Time) time.Time {
	return t.AddDate(0, 0, -1)
}
func PrevMonth(t time.Time) time.Time {
	return t.AddDate(0, -1, 0)
}
func PrevYear(t time.Time) time.Time {
	return t.AddDate(-1, 0, 0)
}
func NextDay(t time.Time) time.Time {
	return t.AddDate(0, 0, 1)
}
func NextMonth(t time.Time) time.Time {
	return t.AddDate(0, 1, 0)
}
func NextYear(t time.Time) time.Time {
	return t.AddDate(1, 0, 0)
}