Permalink
Browse files

Merge branch 'wip-mdl-32234-m22' of git://github.com/rajeshtaneja/moo…

…dle into MOODLE_22_STABLE
  • Loading branch information...
stronk7 committed May 2, 2012
2 parents 58d0533 + daa44ab commit 46d732c25267cff90032b5e6bf6a125856253777
Showing with 11 additions and 2 deletions.
  1. +9 −0 lib/moodlelib.php
  2. +2 −2 lib/simpletest/testmoodlelib.php
View
@@ -2039,6 +2039,15 @@ function usergetdate($time, $timezone=99) {
$getdate['seconds']
) = explode('_', $datestring);
+ // set correct datatype to match with getdate()
+ $getdate['seconds'] = (int)$getdate['seconds'];
+ $getdate['yday'] = (int)$getdate['yday'] - 1; // gettime returns 0 through 365
+ $getdate['year'] = (int)$getdate['year'];
+ $getdate['mon'] = (int)$getdate['mon'];
+ $getdate['wday'] = (int)$getdate['wday'];
+ $getdate['mday'] = (int)$getdate['mday'];
+ $getdate['hours'] = (int)$getdate['hours'];
+ $getdate['minutes'] = (int)$getdate['minutes'];
return $getdate;
}
@@ -1028,7 +1028,7 @@ function test_usergetdate() {
$this->assertEqual($wday,3);
$this->assertEqual($mon,12);
$this->assertEqual($year,2009);
- $this->assertEqual($yday,357);
+ $this->assertEqual($yday,356);
$this->assertEqual($weekday, 'Wednesday');
$this->assertEqual($month, 'December');
@@ -1043,7 +1043,7 @@ function test_usergetdate() {
$this->assertEqual($wday,3);
$this->assertEqual($mon,12);
$this->assertEqual($year,2009);
- $this->assertEqual($yday,357);
+ $this->assertEqual($yday,356);
$this->assertEqual($weekday, 'Wednesday');
$this->assertEqual($month, 'December');

0 comments on commit 46d732c

Please sign in to comment.