You can use two fields plus an inputActions
parameter, like this:
\define convertDate()
<$let pat="[-T:]">
<$action-setfield h_date_start={{{ [<actionValue>search-replace:g:regexp<pat>,[]] }}}/>
\end
<$edit-text field="h_date_start_input"
tag="input" type="datetime-local" inputActions="<<convertDate>>"/>
INPUT={{!!h_date_start_input}}<br>
VAL={{!!h_date_start}}
Notes:
- The
h_date_start_input
field holds the input from the $edit-text
widget
- The
h_date_start
field holds the input value converted to the desired format
-
inputActions=...
invokes <<convertDate>>
on each keystroke, and takes the current input (in the actionValue
variable), strips out the '-, âTâ, and â:â characters, and saves it input the h_date_start
target field
-e