diff options
Diffstat (limited to 'src/Model/Date.hs')
-rw-r--r-- | src/Model/Date.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Model/Date.hs b/src/Model/Date.hs index 60108e9..081dccc 100644 --- a/src/Model/Date.hs +++ b/src/Model/Date.hs @@ -5,6 +5,7 @@ module Model.Date , renderDate , getCurrentDate , getNextWeek + , getWeekDay , plusDays , sameDayAndMonth , isBeforeOrEqualDayAndMonth @@ -18,6 +19,7 @@ import Text.Printf (printf) import Data.Time.Clock import Data.Time.Calendar import Data.Time.LocalTime +import Data.Time.Format (formatTime, defaultTimeLocale) import Data.Text (Text) import qualified Data.Text as T import Data.Maybe (isJust) @@ -55,6 +57,9 @@ getNextWeek = do let end = begin `plusDays` 6 return (begin, end) +getWeekDay :: Date -> Text +getWeekDay = T.toLower . T.pack . formatTime defaultTimeLocale "%A" . dateToDay + plusDays :: Date -> Int -> Date plusDays date n = dateFromDay . addDays (toInteger n) . dateToDay $ date |