Skip to content

Commit a2d155f

Browse files
authored
Merge pull request #36 from jmformenti/master
Import Julian dates
2 parents 3a0976e + 5175807 commit a2d155f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

public_html/quickstatements.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,16 +1526,21 @@ protected function parseValueV1 ( $v , &$cmd ) {
15261526
return true ;
15271527
}
15281528

1529-
if ( preg_match ( '/^([+-]{0,1})(\d+)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z\/{0,1}(\d*)$/i' , $v , $m ) ) { // TIME
1529+
if ( preg_match ( '/^([+-]{0,1})(\d+)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z\/{0,1}(\d*)(\/J){0,1}$/i' , $v , $m ) ) { // TIME
15301530
$prec = 9 ;
15311531
if ( $m[8] != '' ) $prec = $m[8]*1 ;
1532+
$is_julian = false ;
1533+
if ( count($m) == 10 ) {
1534+
$is_julian = true ;
1535+
$v = preg_replace ( '/\/J$/', '', $v ) ;
1536+
}
15321537
$cmd['datavalue'] = array ( "type"=>"time" , "value"=>array(
15331538
'time' => preg_replace ( '/\/\d+$/' , '' , $v ) ,
15341539
'timezone' => 0 ,
15351540
'before' => 0 ,
15361541
'after' => 0 ,
15371542
'precision' => $prec ,
1538-
'calendarmodel' => 'http://www.wikidata.org/entity/Q1985727'
1543+
'calendarmodel' => $is_julian ? 'http://www.wikidata.org/entity/Q1985786' : 'http://www.wikidata.org/entity/Q1985727'
15391544
) ) ;
15401545
return true ;
15411546
}

0 commit comments

Comments
 (0)