jokes-bapak2/api/app/v1/utils/date.go

19 lines
299 B
Go
Raw Normal View History

2021-07-09 06:11:11 +00:00
package utils
import "time"
// IsToday checks if a date is in fact today or not.
func IsToday(date string) (bool, error) {
parse, err := time.Parse(time.UnixDate, date)
if err != nil {
return false, err
}
now := time.Now()
if parse.Equal(now) {
return true, nil
}
return false, nil
}