]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Utils/DateUtils.hs
File missing
[gargantext.git] / src / Gargantext / Utils / DateUtils.hs
1 module Gargantext.Utils.DateUtils where
2
3 import Gargantext.Prelude
4 import Data.Time (UTCTime, toGregorian, utctDay)
5
6 --
7 --readInt :: IO [Char] -> IO Int
8 --readInt = readLn
9 --
10 --readBool :: IO [Char] -> IO Bool
11 --readBool = readLn
12
13 utc2gregorian :: UTCTime -> (Integer, Int, Int)
14 utc2gregorian date = toGregorian $ utctDay date
15
16 gregorian2year :: (Integer, Int, Int) -> Integer
17 gregorian2year (y, _m, _d) = y
18
19 utc2year :: UTCTime -> Integer
20 utc2year date = gregorian2year $ utc2gregorian date
21
22 averageLength :: Fractional a => [[a1]] -> a
23 averageLength l = fromIntegral (sum (map length l)) / fromIntegral (length l)
24
25 --main :: IO ()
26 --main = do
27 -- c <- getCurrentTime
28 -- print c -- $ toYear $ toGregorian $ utctDay c
29