From 1e47a7754ca38bd1a6c74765d8378caf68ce4619 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 26 Mar 2017 21:10:42 +0200 Subject: Separate client and server watch --- src/client/elm/Validation.elm | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/client/elm/Validation.elm (limited to 'src/client/elm/Validation.elm') diff --git a/src/client/elm/Validation.elm b/src/client/elm/Validation.elm deleted file mode 100644 index 18b3934..0000000 --- a/src/client/elm/Validation.elm +++ /dev/null @@ -1,38 +0,0 @@ -module Validation exposing - ( date - , category - ) - -import Date exposing (Date) -import Date.Extra.Core exposing (intToMonth) -import Date.Extra.Create exposing (dateFromFields) -import Dict -import String exposing (toInt, split) - -import Form.Validate as Validate exposing (..) - -import Model.Category exposing (Categories, CategoryId) - -date : Validation String Date -date = - customValidation string (\str -> - case split "/" str of - [day, month, year] -> - case (toInt day, toInt month, toInt year) of - (Ok dayNum, Ok monthNum, Ok yearNum) -> - Ok (dateFromFields yearNum (intToMonth monthNum) dayNum 0 0 0 0) - _ -> Err (customError "InvalidDate") - _ -> Err (customError "InvalidDate") - ) - -category : Categories -> Validation String CategoryId -category categories = - customValidation string (\str -> - case toInt str of - Ok category -> - if List.member category (Dict.keys categories) - then Ok category - else Err (customError "InvalidCategory") - Err _ -> - Err (customError "InvalidCategory") - ) -- cgit v1.2.3