File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -249,14 +249,17 @@ protected function buildMetadataRequest(array $data) {
249249 if (array_key_exists ("datacite.dateIssued " , $ data )) {
250250 $ di = str_replace ('X ' , '0 ' , $ data ["datacite.dateIssued " ][0 ]["value " ]);
251251 $ years = array ();
252+ // If the date is not a standard date in the form YYYY-MM-DD, just pull the year
252253 if (!preg_match ('/^\d{4}-\d{2}-\d{2}$/ ' , $ data ["datacite.year " ][0 ]["value " ])) {
253254 preg_match ('/\b[\dX]{4}\b/ ' , $ di , $ years );
254255 $ di = $ years [0 ];
255256 }
256257
257- $ date = $ dates ->addChild ('date ' , $ di )->addAttribute ('dateType ' , 'Issued ' );
258+ $ date = $ dates ->addChild ('date ' , $ di );
259+ $ date ->addAttribute ('dateType ' , 'Issued ' );
260+ // If our stored date differs from the original, put the original in the dateInformation attribute
258261 if ($ di !== $ data ["datacite.dateIssued " ][0 ]["value " ])
259- $ date ->addAttribute ('dateInformation ' , $ data ["datacite.dateIssued " ]);
262+ $ date ->addAttribute ('dateInformation ' , $ data ["datacite.dateIssued " ][ 0 ][ " value " ] );
260263 }
261264
262265 // Language.
You can’t perform that action at this time.
0 commit comments