0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-25 13:02:48 +01:00
gitea/vendor/gopkg.in/testfixtures.v2/time.go
2016-12-31 10:17:45 +01:00

36 lines
688 B
Go

package testfixtures
import "regexp"
var (
regexpDate = regexp.MustCompile("\\d\\d\\d\\d-\\d\\d-\\d\\d")
regexpDateTime = regexp.MustCompile("\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d")
regexpTime = regexp.MustCompile("\\d\\d:\\d\\d:\\d\\d")
)
func isDate(value interface{}) bool {
str, isStr := value.(string)
if !isStr {
return false
}
return regexpDate.MatchString(str)
}
func isDateTime(value interface{}) bool {
str, isStr := value.(string)
if !isStr {
return false
}
return regexpDateTime.MatchString(str)
}
func isTime(value interface{}) bool {
str, isStr := value.(string)
if !isStr {
return false
}
return regexpTime.MatchString(str)
}