@@ -164,16 +164,22 @@ raiseSelectionChanged ::
164
164
Maybe Date ->
165
165
Maybe Time ->
166
166
ComponentM m Unit
167
- raiseSelectionChanged mInterval mDate mTime = case mInterval of
168
- Nothing -> H .raise $ SelectionChanged mDateTime
169
- Just interval -> case mDateTime of
170
- Nothing -> H .raise $ SelectionChanged mDateTime
171
- Just dateTime
172
- | isWithinInterval interval dateTime -> H .raise $ SelectionChanged mDateTime
173
- | otherwise -> pure unit -- NOTE transient state during parent-child synchronization
167
+ raiseSelectionChanged mInterval mDate mTime = case maybeSelection of
168
+ Nothing -> pure unit
169
+ Just selection -> case mInterval of
170
+ Nothing -> H .raise $ SelectionChanged selection
171
+ Just interval -> case selection of
172
+ Nothing -> H .raise $ SelectionChanged selection
173
+ Just dateTime
174
+ | isWithinInterval interval dateTime -> H .raise $ SelectionChanged selection
175
+ | otherwise -> pure unit -- NOTE transient state during parent-child synchronization
174
176
where
175
- mDateTime :: Maybe DateTime
176
- mDateTime = DateTime <$> mDate <*> mTime
177
+ maybeSelection :: Maybe (Maybe DateTime )
178
+ maybeSelection = case mDate, mTime of
179
+ Nothing , Nothing -> Just Nothing
180
+ Nothing , Just _ -> Nothing
181
+ Just _, Nothing -> Nothing
182
+ Just date, Just time -> Just $ Just $ Date.DateTime.DateTime date time
177
183
178
184
render :: forall m . MonadAff m => ComponentRender m
179
185
render state =
0 commit comments