Esempio n. 1
0
 public static function relativeDate($date, $unit = null, $time = null)
 {
     if (is_null($date) || $date == '@') {
         return '';
     }
     if (is_null($time) || $time == '@') {
         $time = JFactory::getDate('now');
     }
     return JHtmlDate::relative($date, $unit, $time);
 }
Esempio n. 2
0
 /**
  * Tests the JHtmlDate::relative method.
  *
  * @param	string  $result  The expected test result
  * @param   string  $date    The date to convert
  * @param   string  $unit    The optional unit of measurement to return
  *                           if the value of the diff is greater than one
  * @param   string  $time    An optional time to compare to, defaults to now
  *
  * @return  void
  *
  * @since   11.3
  * @dataProvider dataTestRelative
  */
 public function testRelative($result, $date, $unit = null, $time = null)
 {
     $this->assertThat(JHtmlDate::relative($date, $unit, $time), $this->equalTo($result));
 }
Esempio n. 3
0
 /**
  * Tests the JHtmlDate::relative method.
  *
  * @param   string  $result  The expected test result
  * @param   string  $date    The date to convert
  * @param   string  $unit    The optional unit of measurement to return
  *                            if the value of the diff is greater than one
  * @param   string  $time    An optional time to compare to, defaults to now
  *
  * @return  void
  *
  * @since   3.1
  * @dataProvider dataTestRelative
  */
 public function testRelative($result, $date, $unit = null, $time = null)
 {
     $this->assertEquals($result, JHtmlDate::relative($date, $unit, $time));
 }