File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -183,23 +183,24 @@ const InspectorControls = memo( props => {
183183 videoUploadDate : '' ,
184184 } ) }
185185 onChange = { media => {
186- let videoUploadDate = ''
186+ let videoUploadDate = null
187187
188- try {
189- videoUploadDate = media . date ?. toISOString ( )
190- } catch ( error ) {
188+ if ( media . date ) {
191189 try {
192- videoUploadDate = new Date ( media . date ) . toISOString ( )
190+ videoUploadDate = media . date instanceof Date
191+ ? media . date . toISOString ( )
192+ : new Date ( media . date ) . toISOString ( )
193193 } catch ( error ) {
194- videoUploadDate = ''
194+ videoUploadDate = null
195195 }
196196 }
197+
197198 props . setAttributes ( {
198199 videoLink : media . url ,
199200 videoId : media . url ,
200201 videoName : media . title , // Use title, description and date from media library for video schema
201202 videoDescription : media . description || '' ,
202- videoUploadDate,
203+ videoUploadDate : videoUploadDate ?? undefined ,
203204 } )
204205 } }
205206 imageId = { urlIsVideo ( props . videoLink ) ? props . videoId : '' }
You can’t perform that action at this time.
0 commit comments