From ce74e23d872943834bde77c6b5f759f2b025bf72 Mon Sep 17 00:00:00 2001 From: Maximilian Tagher Date: Fri, 28 Nov 2014 15:57:01 -0500 Subject: [PATCH] `timeField` now uses `type="time"` * Also removes deprecation from `timeField` * Also mildly discourages using `timeFieldTypeText` --- yesod-form/Yesod/Form/Fields.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs index 84c42c8b..3c3a0d2b 100644 --- a/yesod-form/Yesod/Form/Fields.hs +++ b/yesod-form/Yesod/Form/Fields.hs @@ -154,10 +154,9 @@ $newline never } where showVal = either id (pack . show) --- | An alias for 'timeFieldTypeText'. +-- | An alias for 'timeFieldTypeTime'. timeField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m TimeOfDay -timeField = timeFieldTypeText -{-# DEPRECATED timeField "'timeField' currently defaults to an input of type=\"text\". In the next major release, it will default to type=\"time\". To opt in to the new functionality, use 'timeFieldTypeTime'. To keep the existing behavior, use 'timeFieldTypeText'. See 'https://github.com/yesodweb/yesod/pull/874' for details." #-} +timeField = timeFieldTypeTime -- | Creates an input with @type="time"@. will fallback to a text field, and Yesod will parse the time as described in 'timeFieldTypeText'. -- @@ -168,6 +167,8 @@ timeFieldTypeTime :: Monad m => RenderMessage (HandlerSite m) FormMessage => Fie timeFieldTypeTime = timeFieldOfType "time" -- | Creates an input with @type="text"@, parsing the time from an [H]H:MM[:SS] format, with an optional AM or PM (if not given, AM is assumed for compatibility with the 24 hour clock system). +-- +-- This function exists for backwards compatibility with the old implementation of 'timeField', which used to use @type="text"@. Consider using 'timeField' or 'timeFieldTypeTime' for improved UX and validation from the browser. -- -- Add the @time@ package and import the "Data.Time.LocalTime" module to use this function. --