/* private */ $wgDateFormatsFy = array(
'Gjin foarkar',
- '16:12, jan 15, 2001',
- '16:12, 15 jan 2001',
- '16:12, 2001 jan 15',
+ '16.12, jan 15, 2001',
+ '16.12, 15 jan 2001',
+ '16.12, 2001 jan 15',
'ISO 8601' => '2001-01-15 16:12:34'
);
return $wgDateFormatsFy;
}
- function date( $ts, $adj = false ) {
+ /**
+ * @access public
+ * @param mixed $ts the time format which needs to be turned into a
+ * date('YmdHis') format with wfTimestamp(TS_MW,$ts)
+ * @param bool $adj whether to adjust the time output according to the
+ * user configured offset ($timecorrection)
+ * @param bool $format true to use user's date format preference
+ * @param string $timecorrection the time offset as returned by
+ * validateTimeZone() in Special:Preferences
+ * @return string
+ */
+ function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
global $wgUser;
- if ( $adj ) { $ts = $this->userAdjust( $ts ); }
-
- switch ( $wgUser->getOption( 'date' ) ) {
- # jan 8, 2001
- case '0': case '1': return $d = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) )
- . ' ' . (0 + substr( $ts, 6, 2 )) . ', ' . substr( $ts, 0, 4 );
- # 8 jannewaris 2001
- case '2': return (0 + substr( $ts, 6, 2 )) . ' ' .
- $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . ' ' .
- substr( $ts, 0, 4 );
- case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
- # 2001 jannewaris 8
- default: return substr( $ts, 0, 4 ) . ' ' .
- $this->getMonthAbbreviation( substr( $ts, 4, 2 ) )
- . ' ' . (0 + substr( $ts, 6, 2 ));
+ if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
+
+ $datePreference = $this->dateFormat( $format );
+
+ $month = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) );
+ $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) );
+ $year = $this->formatNum( substr( $ts, 0, 4 ), true );
+
+ switch( $datePreference ) {
+ case MW_DATE_DMY: return "$day $month $year";
+ case MW_DATE_YMD: return "$year $month $day";
+ case MW_DATE_ISO: return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
+ default: return "$month $day, $year";
}
}
- function timeanddate( $ts, $adj = false ) {
+ /**
+ * @access public
+ * @param mixed $ts the time format which needs to be turned into a
+ * date('YmdHis') format with wfTimestamp(TS_MW,$ts)
+ * @param bool $adj whether to adjust the time output according to the
+ * user configured offset ($timecorrection)
+ * @param bool $format true to use user's date format preference
+ * @param string $timecorrection the time offset as returned by
+ * validateTimeZone() in Special:Preferences
+ * @return string
+ */
+ function time( $ts, $adj = false, $format = true, $timecorrection = false ) {
global $wgUser;
- switch ( $wgUser->getOption( 'date' ) ) {
- case 'ISO 8601': return $this->date( $ts, $adj ) . ' ' . $this->time( $ts, $adj );
- default: return $this->time( $ts, $adj ) . ', ' . $this->date( $ts, $adj );
+ if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
+ $datePreference = $this->dateFormat( $format );
+
+ if ( $datePreference == MW_DATE_ISO ) {
+ $sep = ':';
+ } else {
+ $sep = '.';
}
- }
+
+ $t = substr( $ts, 8, 2 ) . $sep . substr( $ts, 10, 2 );
+ if ( $datePreference == MW_DATE_ISO ) {
+ $t .= $sep . substr( $ts, 12, 2 );
+ }
+ return $this->formatNum( $t );
+ }
+
function getMessage( $key ) {
global $wgAllMessagesFy;
if( isset( $wgAllMessagesFy[$key] ) ) {