File tree 1 file changed +7
-4
lines changed
packages/decap-cms-widget-datetime/src
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 {
62
62
isDisabled : false ,
63
63
} ;
64
64
65
+ componentDidMount ( ) {
66
+ const { value } = this . props ;
67
+ if ( value === '{{now}}' ) {
68
+ this . handleChange ( this . getNow ( ) ) ;
69
+ }
70
+ }
71
+
65
72
isUtc = this . props . field . get ( 'picker_utc' ) || false ;
66
73
67
74
escapeZ ( str ) {
@@ -123,10 +130,6 @@ class DateTimeControl extends React.Component {
123
130
if ( value === '' ) return value ;
124
131
const { format, inputFormat } = this . getFormat ( ) ;
125
132
126
- if ( typeof value === 'string' && value ?. replace ( / \s + / g, '' ) === '{{now}}' ) {
127
- return this . getNow ( ) ;
128
- }
129
-
130
133
const inputValue = this . isUtc
131
134
? dayjs . utc ( value , format ) . format ( inputFormat )
132
135
: dayjs ( value , format ) . format ( inputFormat ) ;
You can’t perform that action at this time.
0 commit comments