diff --git a/make-pages/Info.hs b/make-pages/Info.hs index 96b3208..ad615f3 100644 --- a/make-pages/Info.hs +++ b/make-pages/Info.hs @@ -17,7 +17,7 @@ import Data.Maybe (isJust, isNothing) import Data.String (IsString) import Data.Text (Text) import qualified Data.Text as Text -import Data.Time.Calendar (Day (..)) +import Data.Time.Calendar (Day (..), toGregorian) import Data.YAML (FromYAML (..), (.:), (.:?), (.!=)) import qualified Data.YAML as YAML import Text.Read (readMaybe) @@ -76,6 +76,12 @@ instance HasField "thumb" Info (Maybe FilePath) where instance HasField "mine" Info Bool where getField = isNothing . #artist instance HasField "notMine" Info Bool where getField = isJust . #artist +instance HasField "dmy" Info (Integer, Int, Int) where + getField = toGregorian . #date +instance HasField "year" Info Integer where getField = #first . #dmy +instance HasField "month" Info Int where getField = #second . #dmy +instance HasField "day" Info Int where getField = #third . #dmy + instance FromYAML Info where parseYAML = YAML.withMap "info" \m ->