refactor check for valid yob

This commit is contained in:
Carlosokumu 2024-11-21 11:25:47 +03:00
parent 9b89462797
commit 8925e26c4c
Signed by untrusted user: carlos
GPG Key ID: 7BD6BC8160A5C953

View File

@ -154,7 +154,7 @@ func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (r
code := strings.Split(symbol, "_")[1] code := strings.Split(symbol, "_")[1]
if !utils.IsValidISO639(code) { if !utils.IsValidISO639(code) {
//Fallback to english instead? //Fallback to english instead?
code = "eng" code = "eng"
} }
res.FlagSet = append(res.FlagSet, state.FLAG_LANG) res.FlagSet = append(res.FlagSet, state.FLAG_LANG)
@ -764,12 +764,11 @@ func (h *Handlers) VerifyYob(ctx context.Context, sym string, input []byte) (res
return res, nil return res, nil
} }
if len(date) == 4 { if utils.IsValidYOb(date) {
res.FlagReset = append(res.FlagReset, flag_incorrect_date_format) res.FlagReset = append(res.FlagReset, flag_incorrect_date_format)
} else { } else {
res.FlagSet = append(res.FlagSet, flag_incorrect_date_format) res.FlagSet = append(res.FlagSet, flag_incorrect_date_format)
} }
return res, nil return res, nil
} }