From 8925e26c4c85aec07702322925cefb608609228d Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 21 Nov 2024 11:25:47 +0300 Subject: [PATCH] refactor check for valid yob --- internal/handlers/ussd/menuhandler.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/handlers/ussd/menuhandler.go b/internal/handlers/ussd/menuhandler.go index a58e344..eeca3fd 100644 --- a/internal/handlers/ussd/menuhandler.go +++ b/internal/handlers/ussd/menuhandler.go @@ -154,7 +154,7 @@ func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (r code := strings.Split(symbol, "_")[1] if !utils.IsValidISO639(code) { - //Fallback to english instead? + //Fallback to english instead? code = "eng" } 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 } - if len(date) == 4 { + if utils.IsValidYOb(date) { res.FlagReset = append(res.FlagReset, flag_incorrect_date_format) } else { res.FlagSet = append(res.FlagSet, flag_incorrect_date_format) } - return res, nil }