I am using reflex-platform with obelisk.
This is my frontend code to get the current date
pb <- getPostBuild
postBuildTime <- performEvent $ pb $> liftIO getCurrentTime
let today = Text.pack . formatTime defaultTimeLocale "%F" <$> postBuildTime
I can confirm that this works by putting
dynText =<< holdDyn "loading" today
which does not even display "loading" for a split second but instead shows "2021-03-26" as expected in the browser (Google Chrome).
However, trying to put the today event into an <input> doesn't work. This is the code:
foo <- inputElement $ def & inputElementConfig_setValue .~ today
The <input> stays blank.
Even weirder: In my actual code the <input> has an initial value via inputElementConfig_initialValue .~ "BAAAR", which doesn't show either. Yet a dynamic text created like
dynText =<< holdDyn "" foo
DOES show "BAAAR" for a split second.
And to calm any paranoia, I tested the inputElementConfig_setValue with a simple button, which worked fine. I.e. I can set the value of <input> by clicking on a button.
So the postBuildTime event works and the inputElementConfig_setValue works, but the combination of the two leaves the <input> blank.
EDIT
Minimal example including instructions on how to run and screenshot of the result: