Commit b62b0547 authored by Camil Staps's avatar Camil Staps 🍃

Merge branch 'dateTimeGastInstances' into 'master'

add Gast instances for DateTime.Time

See merge request !339
parents 6227658d cb87ae27
Pipeline #31280 passed with stage
in 6 minutes and 36 seconds
......@@ -5,6 +5,7 @@ definition module iTasks.Extensions.DateTime
import iTasks.WF.Definition
from Data.Error import :: MaybeError, :: MaybeErrorString
from Text.GenPrint import generic gPrint, :: PrintState, class PrintOutput
from StdString import class toString, class fromString
from StdClass import class <
from StdOverloaded import class ==
......@@ -22,6 +23,8 @@ from StdOverloaded import class ==
, sec :: !Int
}
derive gPrint Time
:: DateTime =
{ year :: !Int
, mon :: !Int
......@@ -55,7 +58,6 @@ derive gEq Date, Time, DateTime
derive gText Date, Time, DateTime
derive gEditor Date, Time, DateTime
/*** Time & Date Conversion ***/
/**
* Converts a timestamp to UTC DateTime.
......
......@@ -18,7 +18,7 @@ import iTasks.Internal.SDS
import StdBool, StdArray, StdEnum, StdList, StdString
import Text, Text.GenJSON, System.Time
import Text, Text.GenJSON, Text.GenPrint, System.Time
import Data.Maybe, Data.Error
import qualified Data.Map as DM
......@@ -113,6 +113,7 @@ gEditor{|Time|} = selectByMode
derive gDefault Time
derive gEq Time
derive gPrint Time
instance toString DateTime
where
......
definition module iTasks.Extensions.DateTime.Gast
from iTasks.Extensions.DateTime import :: Time
from Gast import generic genShow, generic ggen, :: GenState
derive ggen Time
derive genShow Time
implementation module iTasks.Extensions.DateTime.Gast
import StdEnv, Gast, iTasks.Extensions.DateTime
ggen{|Time|} _ = [{Time| hour = h, min = m, sec = s} \\ (h,m,s) <- diag3 [0..23] [0..59] [0..59]]
derive genShow Time
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment