Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -206,14 +206,17 @@ class DateTime extends \DateTime
|
||||
* @param bool $capitalize TRUE if by itself, FALSE if in the middle of a sentence
|
||||
* @param bool $short Whether or not to use the short form
|
||||
* @param Lang|Member|null $memberOrLanguage The language or member to use, or NULL for currently logged in member
|
||||
* @param bool $useTitle Whether to add a title attribute to the <time> element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function html(bool $capitalize=TRUE, bool $short=FALSE, Lang|Member $memberOrLanguage=NULL ): string
|
||||
public function html(bool $capitalize=TRUE, bool $short=FALSE, Lang|Member $memberOrLanguage=NULL, bool $useTitle = true ): string
|
||||
{
|
||||
$format = $short ? 1 : ( $capitalize ? static::RELATIVE_FORMAT_NORMAL : static::RELATIVE_FORMAT_LOWER );
|
||||
$shortLong = $short ? 'short' : 'long';
|
||||
$title = $useTitle ? "title='{$this}'" : '';
|
||||
|
||||
return "<time datetime='{$this->rfc3339()}' title='{$this}' data-short='" . trim( $this->relative( 1, $memberOrLanguage ) ) . "' class='ipsTime ipsTime--{$shortLong}'><span class='ipsTime__long'>" . trim( $this->relative( $format, $memberOrLanguage ) ) . "</span><span class='ipsTime__short'>" . trim( $this->relative( 1, $memberOrLanguage ) ) . "</span></time>";
|
||||
return "<time datetime='{$this->rfc3339()}' {$title} data-short='" . trim( $this->relative( 1, $memberOrLanguage ) ) . "' class='ipsTime ipsTime--{$shortLong}'><span class='ipsTime__long'>" . trim( $this->relative( $format, $memberOrLanguage ) ) . "</span><span class='ipsTime__short'>" . trim( $this->relative( 1, $memberOrLanguage ) ) . "</span></time>";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user