]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16606 "userdate inserts a space in front of date when chopping off the leading...
authorjamiesensei <jamiesensei>
Mon, 22 Sep 2008 10:32:28 +0000 (10:32 +0000)
committerjamiesensei <jamiesensei>
Mon, 22 Sep 2008 10:32:28 +0000 (10:32 +0000)
extra space was used in front of %d so that we can detect the difference between a leading 0 and something like 10, 20, or 30. The extra space was removed along with any leading 0 but not if there was no leading zero.

Now removing extra space even if there is no leading zero.

Now applying fix to conditional branch for when using a time offset from GMT instead of server time.

lib/moodlelib.php

index 452f71f1e571d78409c9bf9010f6d715d0bf8b81..c9c5ee83214c5bb8e134302495678baee4d0dd00 100644 (file)
@@ -1263,7 +1263,7 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
         $date += (int)($timezone * 3600);
         if ($fixday) {
             $datestring = gmstrftime($formatnoday, $date);
-            $daystring  = str_replace(' 0', '', gmstrftime(' %d', $date));
+            $daystring  = str_replace(array(' 0', ' '), '', gmstrftime(' %d', $date));
             $datestring = str_replace('DD', $daystring, $datestring);
         } else {
             $datestring = gmstrftime($format, $date);