diff --git a/src/Vervis/Handler/Group.hs b/src/Vervis/Handler/Group.hs index ebb4fd1..5ece8b9 100644 --- a/src/Vervis/Handler/Group.hs +++ b/src/Vervis/Handler/Group.hs @@ -39,6 +39,7 @@ import Vervis.Foundation import Vervis.Model import Vervis.Model.Ident (ShrIdent, shr2text) import Vervis.Settings (widgetFile) +import Vervis.Time (showDate) import Vervis.Widget.Sharer (groupLinkW, personLinkW) getGroupsR :: Handler Html diff --git a/src/Vervis/Time.hs b/src/Vervis/Time.hs new file mode 100644 index 0000000..ef0959d --- /dev/null +++ b/src/Vervis/Time.hs @@ -0,0 +1,34 @@ +{- This file is part of Vervis. + - + - Written in 2016 by fr33domlover . + - + - ♡ Copying is an act of love. Please copy, reuse and share. + - + - The author(s) have dedicated all copyright and related and neighboring + - rights to this software to the public domain worldwide. This software is + - distributed without any warranty. + - + - You should have received a copy of the CC0 Public Domain Dedication along + - with this software. If not, see + - . + -} + +module Vervis.Time + ( showDate + ) +where + +import Prelude + +import Data.Text (Text) +import Data.Time.Calendar (toGregorian) +import Data.Time.Clock (UTCTime (..)) +import Formatting (sformat, (%), int, left) + +import qualified Data.Text as T (take) + +showDate :: UTCTime -> Text +showDate t = + let (y, m, d) = toGregorian $ utctDay t + padded = left 2 '0' + in sformat (int % "-" % padded % "-" % padded) y m d diff --git a/src/Vervis/Widget.hs b/src/Vervis/Widget.hs index e889c88..24a327b 100644 --- a/src/Vervis/Widget.hs +++ b/src/Vervis/Widget.hs @@ -35,6 +35,7 @@ import Data.Revision.Local import Development.DarcsRev (darcsTotalPatches, darcsRevision) import Vervis.Settings (widgetFile) import Vervis.Style +import Vervis.Time (showDate) breadcrumbsW :: YesodBreadcrumbs site => WidgetT site IO () breadcrumbsW = do @@ -43,11 +44,7 @@ breadcrumbsW = do revisionW :: WidgetT site IO () revisionW = - let fmtTime t = - let (y, m, d) = toGregorian $ utctDay t - padded = left 2 '0' - in sformat (int % "-" % padded % "-" % padded) y m d - cgTimeFmt = fmtTime . cgTime + let cgTimeFmt = showDate . cgTime mrev = $darcsRevision sharer = "fr33domlover" :: Text repo = "vervis" :: Text diff --git a/templates/group/one.hamlet b/templates/group/one.hamlet index d537141..3de334a 100644 --- a/templates/group/one.hamlet +++ b/templates/group/one.hamlet @@ -15,6 +15,9 @@ $# .

#{fromMaybe (shr2text $ sharerIdent group) $ sharerName group} +

+ Created on #{showDate $ sharerCreated group}. +

Members: diff --git a/vervis.cabal b/vervis.cabal index b14b269..cf06a67 100644 --- a/vervis.cabal +++ b/vervis.cabal @@ -124,6 +124,7 @@ library Vervis.Ssh Vervis.Style Vervis.TicketFilter + Vervis.Time Vervis.Widget Vervis.Widget.Discussion Vervis.Widget.Repo