Include a fast path to invalidate YearMonth

This commit is contained in:
Eduard Urbach 2019-09-06 08:20:45 +09:00
parent 0aa0a5ad4f
commit f1adae4337
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -60,7 +60,7 @@ func Date(date string) bool {
// YearMonth tells you whether the date contain only the year and the month. // YearMonth tells you whether the date contain only the year and the month.
func YearMonth(date string) bool { func YearMonth(date string) bool {
if date == "" || strings.HasPrefix(date, "0001") { if len(date) != len(YearMonthFormat) || strings.HasPrefix(date, "0001") {
return false return false
} }