* xij j (day number) in Iranian calendar
* xiF F (month name) in Iranian calendar
* xin n (month number) in Iranian calendar
+ * xiy y (two digit year) in Iranian calendar
* xiY Y (full year) in Iranian calendar
*
* xjj j (day number) in Hebrew calendar
case 'y':
$num = substr( $ts, 2, 2 );
break;
+ case 'xiy':
+ if ( !$iranian ) {
+ $iranian = self::tsToIranian( $ts );
+ }
+ $num = substr( $iranian[0], -2 );
+ break;
case 'a':
$s .= intval( substr( $ts, 8, 2 ) ) < 12 ? 'am' : 'pm';
break;
array( 'Be-x-old', 'With extension (two dashes)' ),
);
}
+
+ /**
+ * @dataProvider provideSprintfDateSamples
+ */
+ function testSprintfDate( $format, $ts, $expected, $msg ) {
+ $this->assertEquals(
+ $expected,
+ $this->lang->sprintfDate( $format, $ts ),
+ "sprintfDate('$format', '$ts'): $msg"
+ );
+ }
+
+ function provideSprintfDateSamples() {
+ return array(
+ array(
+ 'xiY',
+ '20111212000000',
+ '1390', // note because we're testing English locale we get Latin-standard digits
+ 'Iranian calendar full year'
+ ),
+ array(
+ 'xiy',
+ '20111212000000',
+ '90',
+ 'Iranian calendar short year'
+ ),
+ );
+ }
}