Index: trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php |
— | — | @@ -409,6 +409,15 @@ |
410 | 410 | $date_str = "$cur_year-$cur_month-$cur_day $cur_time"; |
411 | 411 | $cur_date = SMWDataValueFactory::newTypeIDValue( '_dat', $date_str ); |
412 | 412 | $cur_date_jd = $cur_date->getValueKey(); |
| 413 | + } elseif($unit == 'dayofweekinmonth') { |
| 414 | + // e.g., "3rd Monday of every month" |
| 415 | + $check_month = $cur_date->getMonth(); |
| 416 | + $cur_date_jd += 28 * $period; |
| 417 | + $cur_date = SMWDataValueFactory::newTypeIDValue('_dat', $cur_date_jd); |
| 418 | + if ($cur_date->getMonth() != (($check_month + $period) % 12 )){ |
| 419 | + $cur_date_jd += 7; // add another week |
| 420 | + $cur_date = SMWDataValueFactory::newTypeIDValue('_dat', $cur_date_jd); |
| 421 | + } |
413 | 422 | } else { // $unit == 'day' or 'week' |
414 | 423 | // assume 'day' if it's none of the above |
415 | 424 | $cur_date_jd += ( $unit === 'week' ) ? 7 * $period : $period; |