File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/decap-cms-widget-datetime/src Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,13 @@ class DateTimeControl extends React.Component {
6262 isDisabled : false ,
6363 } ;
6464
65+ componentDidMount ( ) {
66+ const { value } = this . props ;
67+ if ( value === '{{now}}' ) {
68+ this . handleChange ( this . getNow ( ) ) ;
69+ }
70+ }
71+
6572 isUtc = this . props . field . get ( 'picker_utc' ) || false ;
6673
6774 escapeZ ( str ) {
@@ -123,10 +130,6 @@ class DateTimeControl extends React.Component {
123130 if ( value === '' ) return value ;
124131 const { format, inputFormat } = this . getFormat ( ) ;
125132
126- if ( typeof value === 'string' && value ?. replace ( / \s + / g, '' ) === '{{now}}' ) {
127- return this . getNow ( ) ;
128- }
129-
130133 const inputValue = this . isUtc
131134 ? dayjs . utc ( value , format ) . format ( inputFormat )
132135 : dayjs ( value , format ) . format ( inputFormat ) ;
You can’t perform that action at this time.
0 commit comments