38use Wikimedia\Timestamp\ConvertibleTimestamp;
56 return new static( $ts );
75 $tz = $value->getTimeZone();
77 $this->timestamp->setTimezone( $tz );
78 return new DateInterval(
'P0Y' );
80 $interval = $value->getTimeOffsetInterval();
81 $this->timestamp->add( $interval );
99 array $chosenIntervals = []
101 $relativeTo ??=
new self();
102 $user ??= RequestContext::getMain()->getUser();
103 $lang ??= RequestContext::getMain()->getLanguage();
106 $diff = $this->diff( $relativeTo );
108 $user = User::newFromIdentity( $user );
117 $seconds = ( ( ( $diff->days * 24 + $diff->h ) * 60 + $diff->i ) * 60 + $diff->s );
118 $ts =
wfMessage(
'ago', $lang->formatDuration( $seconds, $chosenIntervals ) )->inLanguage( $lang )->text();
134 $tzMsg = $this->format(
'T' );
135 $key =
'timezone-' . strtolower( trim( $tzMsg ) );
137 if ( $msg->exists() ) {
153 $timestamp =
new self( $ts );
154 $timestamp->setTimezone( $localtimezone );
160class_alias( MWTimestamp::class,
'MWTimestamp' );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Group all the pieces relevant to the context of a request into one instance.
A class containing constants representing the names of configuration variables.
const Localtimezone
Name constant for the Localtimezone setting, for use with Config::get()
const LocalTZoffset
Name constant for the LocalTZoffset setting, for use with Config::get()