define( 'MW_DATE_USER_FORMAT', true );
/* private */ $wgDateFormatsEn = array(
- 'No preference',
- 'January 15, 2001',
- '15 January 2001',
- '2001 January 15',
- '2001-01-15'
+ 'Default',
+ '16:12, January 15, 2001',
+ '16:12, 15 January 2001',
+ '16:12, 2001 January 15',
+ 'ISO 8601' => '2001-01-15 16:12:34'
);
/* private */ $wgUserTogglesEn = array(
'specialloguserlabel' => 'User: ',
'speciallogtitlelabel' => 'Title: ',
-# labels for Group: and User: ond Special:Listusers
-'speciallistusersuserlabel' => 'User: ',
-'speciallistusersgrouplabel' => 'Group: ',
-
'passwordtooshort' => 'Your password is too short. It must have at least $1 characters.',
# external editor support
}
function date( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false ) {
- global $wgAmericanDates, $wgUser, $wgUseDynamicDates;
-
+ global $wgAmericanDates, $wgUser;
+
$ts=wfTimestamp(TS_MW,$ts);
if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
- if ( $wgUseDynamicDates ) {
- if ( $format == MW_DATE_USER_FORMAT ) {
- $datePreference = $wgUser->getOption( 'date' );
- } else {
- $options = $this->getDefaultUserOptions();
- $datePreference = $options['date'];
- }
- if ( $datePreference == 0 ) {
- $datePreference = $wgAmericanDates ? 1 : 2;
- }
+
+ if ( $format == MW_DATE_USER_FORMAT ) {
+ $datePreference = $wgUser->getOption( 'date' );
} else {
+ $options = $this->getDefaultUserOptions();
+ $datePreference = $options['date'];
+ }
+
+ if ($datePreference == '0') {
$datePreference = $wgAmericanDates ? 1 : 2;
}
$month = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) );
$day = $this->formatNum( 0 + substr( $ts, 6, 2 ) );
$year = $this->formatNum( substr( $ts, 0, 4 ) );
-
+
switch( $datePreference ) {
- case 1: return "$month $day, $year";
- case 2: return "$day $month $year";
- case 4: return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
- default: return "$year $month $day";
+ case '2': return "$day $month $year";
+ case '3': return "$year $month $day";
+ case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
+ default: return "$month $day, $year";
}
}
if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
$t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
- if ( $seconds || $wgUser->getOption( 'date' ) == 4) {
+ if ( $seconds || $wgUser->getOption( 'date' ) == 'ISO 8601' ) {
$t .= ':' . substr( $ts, 12, 2 );
}
return $this->formatNum( $t );
function timeanddate( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false, $dateandtime = false) {
global $wgUser;
$ts=wfTimestamp(TS_MW,$ts);
- if ( 4 == $wgUser->getOption( 'date' ) ) {
- return $this->date( $ts, $adj, $format, $timecorrection ) . ' ' .
+
+ switch ( $wgUser->getOption( 'date' ) ) {
+ case 'ISO 8601': return $this->date( $ts, $adj, $format, $timecorrection ) . ' ' .
$this->time( $ts, $adj, false, $timecorrection );
- } else {
- return $this->time( $ts, $adj, false, $timecorrection ) . ', ' .
+ default: return $this->time( $ts, $adj, false, $timecorrection ) . ', ' .
$this->date( $ts, $adj, $format, $timecorrection );
}
}